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)
 Setting results of Dyanamic sql to variables

Author  Topic 

cr8nk
Yak Posting Veteran

77 Posts

Posted - 2001-11-19 : 14:00:40
Hello,

I am trying to set the results of a dynamic query to a local variable.

Here is my code.


DECLARE @strSql nvarchar(2000)
DECLARE @total int


SET @total = 0
SET @strSql = "select count(*) from DialerLocation"

EXEC sp_executesql @strSql

I would like to store the result of that query in a variable @total. Is that possible?

thanks,

Cr8nk

   

- Advertisement -