June 9, 2009 at 9:03 am
I want to exec(@sql)
but i am strruggling when the SP has outputs. How do I do this?
Many thanks
June 9, 2009 at 9:25 am
Hi, you should look into sp_executesql instead of EXECUTE. For Details please see BooksOnLine (BOL).
You also might have a look at http://www.sommarskog.se/dynamic_sql.html
If you need more information please tell us a little more what you're looking for.
For details on how to post sample data please see http://www.sqlservercentral.com/articles/Best+Practices/61537/
June 9, 2009 at 12:29 pm
Edward (6/9/2009)
I want to exec(@sql)but i am strruggling when the SP has outputs. How do I do this?
Many thanks
It depends on what kind of outputs you mean (IIRC, there are three kinds). Parameter outputs require the use of sp_executesql. The other two (RETURN value and result set) can be handled almost identically to how they are handled with a stored procedure call.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply