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 2005 Forums
 Transact-SQL (2005)
 Exec procedure with select statement

Author  Topic 

Kurmanc
Yak Posting Veteran

92 Posts

Posted - 2007-12-11 : 10:21:26
Hi,

Is it possible to send more than one value/parameter to a procedure? How is that done?

What I mean is,

this is possible:
EXEC [spTEST] 1, 'spMyProcedure', 20, 'message'

but not this:
EXEC [spTEST] SELECT id, 'spMyProcedure', age, @report FROM #temptest

Regards

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-12-11 : 10:23:14
You have to loop the result and send on line of values (a record) at a time to the spTEST stored procedure.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Kurmanc
Yak Posting Veteran

92 Posts

Posted - 2007-12-11 : 10:24:12
Yes, I was afraid so..

Thanks.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-12-11 : 10:24:28
See http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=94015



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-12-11 : 10:24:58
well... you could hack something up with sp_MSForEachTable but that's an unsupported sproc...

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com <- new version out
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-12-11 : 10:26:48
oh and you do know that you can solve this with reading the temp table in the child sproc?
http://weblogs.sqlteam.com/mladenp/archive/2006/11/03/17197.aspx

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com <- new version out
Go to Top of Page

Kurmanc
Yak Posting Veteran

92 Posts

Posted - 2007-12-11 : 10:30:55
Thanks for your replies, I'll check your posted links.
Go to Top of Page
   

- Advertisement -