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 |
Nowy
Yak Posting Veteran
57 Posts |
Posted - 2007-06-08 : 08:23:59
|
I have written an function that returns 3 values.How can I put this values in an new table? Separate about 3 columnsWhat I do now, is write 3 difference functions that returns 1 value. So I execute 3 functions in sequence, to put it in an new table. But in this way I loss performance. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-06-08 : 08:24:53
|
insert into #temptableselect col1, col2, col3 from dbo.fnMyFirstFunction(12)Peter LarssonHelsingborg, Sweden |
|
|
Nowy
Yak Posting Veteran
57 Posts |
Posted - 2007-06-08 : 08:40:42
|
thnx |
|
|
Nowy
Yak Posting Veteran
57 Posts |
Posted - 2007-06-08 : 09:50:15
|
but by "UPDATE" I have to execute the function 3 times? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-06-08 : 09:54:44
|
quote: Originally posted by Nowy but by "UPDATE" I have to execute the function 3 times?
No. You can INNER JOIN to the table KH |
|
|
Nowy
Yak Posting Veteran
57 Posts |
Posted - 2007-06-08 : 09:55:55
|
can you give me an example? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-06-08 : 09:57:32
|
[code]update tset col2 = f.col2, col3 = f.col3from #temptable t inner join dbo.fnMyFirstFunction(12) fon t.col1 = f.col1[/code] KH |
|
|
Nowy
Yak Posting Veteran
57 Posts |
Posted - 2007-06-08 : 10:00:56
|
thnx |
|
|
|
|
|