Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sureshot
Yak Posting Veteran
72 Posts |
Posted - 2005-05-17 : 21:35:47
|
| DECLARE @testIdListArr TABLE(value int) insert into @testIdListArr select value from dbo.udf_Split(@testIdList,',')I have a UDF Split that returns a table. Since I need to use it often I wanted to keep a copy of it in the SP rather than keep calling split. I was to essentially do something like: DECLARE @testIdListArr TABLE(value int) SET @testIdListArr = dbo.udf_Split(@testIdList,',')That didn't work and I had to resort to: DECLARE @testIdListArr TABLE(value int) insert into @testIdListArr select value from dbo.udf_Split(@testIdList,',')It seems redundant and bothers me though. Anything else I can do? |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-05-17 : 22:09:22
|
| you know, in C# it seems redundant to say:someClass c = new someClass();but that's just the way it is! You gotta play by the syntactical rules of the language you are programming in. (except for C or C++ where you can define some CRAZY macros)- Jeff |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-05-17 : 22:10:25
|
| by the way, if you use a temp table you can say:select valueinto #Tmpfrom dbo.udf_split(@testIDlist,',')That lets you do it all in 1 statement.- Jeff |
 |
|
|
sureshot
Yak Posting Veteran
72 Posts |
Posted - 2005-05-17 : 22:42:22
|
| I'm trying to stay away from temp tables due to potential SP recompiles when I don't need to index anything (and I don't in this case). But thanks for reminding me about that for future cases. |
 |
|
|
|
|
|