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)
 sp_executesql

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-07-23 : 07:34:52
Joe writes "How can I get a result set back when executing sp_executesql. I'm dynamically building my sql command and would like to get back a simple value from a select."

Andraax
Aged Yak Warrior

790 Posts

Posted - 2003-07-23 : 07:44:36
Use a table/temp table like so:

insert #t
exec sp_executesql N'select 17'

Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-07-23 : 07:47:14
quote:

How can I get a result set back when executing sp_executesql....to get back a simple value from a select."



Which do you want, a rowset or a value? For the former, Andraax's suggestion is solid. For the later, use sp_executesql to return an output valued parameter.

Jay White
{0}
Go to Top of Page
   

- Advertisement -