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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Returning more than one value from a functio?

Author  Topic 

kam
Starting Member

17 Posts

Posted - 2006-03-16 : 15:43:12
Is the only way to do this by returning a table, or can I just return three seperate values?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-03-16 : 15:47:38
You can return 3 separate values if you concatenate them into one value. A scalar function means to return a single value. A table function means to return a result set. What do you want to do with the 3 values? With your answer, we can steer you into the best UDF choice.

Tara Kizer
aka tduggan
Go to Top of Page

kam
Starting Member

17 Posts

Posted - 2006-03-16 : 15:52:20
I'm trying to create a function which calculates the cross product of a two sets of vector values. My input would be Ai,Aj,Ak and Bi,Bj,Bk and the output would be Zi,Zj,Zk.

Go to Top of Page

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-03-16 : 16:18:18
In ur function find the Cross product and get the calculated vector as a varchar of
Zi + Zj + Zk (eg : 4i + 5k - 7k)
Return it as a Varchar
ie. '4i + 5k - 7k'

and in ur front end application deal with coefficients of i,j & k seperately
Go to Top of Page

kam
Starting Member

17 Posts

Posted - 2006-03-16 : 16:28:20
I need to deal with the returned vector using a procedure - if i return it as a varchar, will there be an easy way to break it back up in to three indivisual values?
Go to Top of Page

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-03-16 : 16:57:05
Procedure --> SQl Server Stored procedure ?
if so, U can find the split function in

http://sqlteam.com/forums/topic.asp?TOPIC_ID=50648
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=60336
Go to Top of Page

kam
Starting Member

17 Posts

Posted - 2006-03-16 : 20:05:06
Thanks for your suggestions.
I've decided to use a table, it seems to be the most efficient of options available.

KAm
Go to Top of Page
   

- Advertisement -