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
 General SQL Server Forums
 New to SQL Server Programming
 Calling SP

Author  Topic 

aprichard
Yak Posting Veteran

62 Posts

Posted - 2009-01-13 : 04:47:38
Hi All,

Is it Possible Calling SP in Select Statement by passing field value as Parameter

Regards
Richard

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-01-13 : 05:03:58
Maybe. It depends on your table layout.
You can make a linked server to yourself and have the procedure name as argument, and have the procedure name taken from table.
Of course with use of dynamic sql. But it is restricted to one column and one row only.

Can you explain more what you are trying to do.
What you have said this far points to bad design.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

aprichard
Yak Posting Veteran

62 Posts

Posted - 2009-01-13 : 05:25:45
Thanks for the information.

The SP would be called based on Result set.

For that what i have done that, I made Cursor for that result set
then calling SP by fetching rows one by one by passeing field value as parameter.

By simplying it, i want to call that sp in the select statement for avoiding cursor.

If possible , please explain me with sample
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-01-13 : 05:29:59
Can you post your tables with data and structure?
Also post detailed information about how you expect the code to work.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

aprichard
Yak Posting Veteran

62 Posts

Posted - 2009-01-13 : 05:39:14
Since this is analysing sp, i cant explain detail,

Please explain how to call sp in select statement
Give sample code

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-01-13 : 05:42:04
Not without knowing how YOUR environment is set.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -