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 |
|
SamC
White Water Yakist
3467 Posts |
Posted - 2004-02-07 : 23:17:58
|
I've got a function that picks apart a piece of data into two values. It was written to return a single value by concatenating the two together into a single string. Sort of a half baked solution. It's used like this:INSERT INTO MyTable (Col1, Col2, CombinedAplusB) SELECT @Value1, @Value2, dbo.MyFunction(@Value1)What I'd like to do is rewrute the function to return two values, but I don't want to do the obvious and end up with two functions. It's a lotta code to duplicate and maintain.I'm considering having the function return a table, it'll have a single row, with two columns. Then (I guess) the INSERT would beINSERT INTO MyTable (Col1, Col2, ColA, ColB) SELECT @Value1, @Value2, X.ColA, X.ColB FROM dbo.MyNewFunction(@Value1) X I guess this would work, but I wanted to know what the gallery thought?Sam |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2004-02-07 : 23:53:44
|
Sam, It is Saturday night, would'nt you rather be playing bubble wrap If you gotta do this I vote for the table data type like you proposed. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-02-09 : 12:39:45
|
11:30 on Saturday night....you need one of those switches that automatically turns the electricity on and off.... Brett8-) |
 |
|
|
monkeybite
Posting Yak Master
152 Posts |
Posted - 2004-02-09 : 12:53:35
|
| Instead of a table valued function, maybe add a parameter to indicate which value you want?For what it's worth, i would probably do it using the table-valued function.~ monkey |
 |
|
|
|
|
|
|
|