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)
 exec query

Author  Topic 

acdacd
Yak Posting Veteran

63 Posts

Posted - 2005-08-16 : 05:51:36
The query is only give out one scaler integer(just count(*))

exec(@queryStr) in query analyser, it give out correct reusult in lower window


But, Select @temp = exec(@queryStr)

Error message "Incorrect syntax near the keyword 'exec'."

How to get the value into @temp??

be a hardworking people!!

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-08-16 : 06:00:57
declare @cnt int
exec sp_executesql N'select @cnt=count(*) from orders', N'@cnt int output', @cnt out
select @cnt


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

- Advertisement -