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
 SQL Server Development (2000)
 Passing vars to stored procedure

Author  Topic 

Stew312
Starting Member

6 Posts

Posted - 2005-03-09 : 10:00:04
I have a stored procedure that I am trying to get a return value for each row of a query, and put it into its own column in my results.. I would like to dynamicaly pass it vars from two different columns, but it does not seem to accept anything except anything except manually entered strings..

I would like to be able to do something like:

select {call spGetDueDate(dateInfo.startDate,dateInfo.duration)} AS dueDate from dateInfo

from Query Analyzer.. Any ideas?

as a side note the stored procedure works fine when I call it like so:

{call spGetDueDate('3/8/2005',1)}


spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-09 : 10:02:41
you can't call a stored procedure for every row like that. user defined functions are for that. try to rewrite the sproc into udf.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

Stew312
Starting Member

6 Posts

Posted - 2005-03-09 : 10:11:20
Would I be able to call from the UDF something like:


select ::spGetDueDate(dateInfo.startDate,dateInfo.duration) AS dueDate from dateInfo

??

Thanks for the heads up
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-09 : 10:14:55
sproc inside udf no. udf's must be deterministic. you can call and extended sproc....

Go with the flow & have fun! Else fight the flow
Go to Top of Page

Stew312
Starting Member

6 Posts

Posted - 2005-03-09 : 10:23:33
its alive!

select dbo.spGetDueDate(dbo.dateInfo.startDate,dbo.dateInfo.duration) AS dueDate from dbo.dateInfo

is the ticket!

Thanks again
Go to Top of Page
   

- Advertisement -