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)
 SQL SERVER SP

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-05-23 : 08:54:25
kevin writes "OK - I want to use EXEC in a stored proc where the sql string is built up, like:

EXEC('Select Count(*) as Rows From ' + @tableName)

I want the number of rows in a local variable. But other than inserting the results into a temp table, I cannot seem to get

SELECT @Rows EXEC(whatever)

to set the value into the local variable. Any help?

Thanks"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-23 : 08:56:25
Read this
http://www.nigelrivett.net/SQLTsql/sp_executesql.html

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -