Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Receive output parameter from exec

Status
Not open for further replies.

eddie11

Programmer
Nov 6, 2003
1
US
Hi

I was trying to get the row count of a variable table
using exec statement but I was getting the following error message while running the query(see the query below).
Any help will be appreciated.


Thanks.

- eddie

Code
****
declare @tbl_name varchar(50)
declare @tcount varchar(50)
declare @txt varchar(100)
select @tbl_name="PUNCTUATION"
exec ("select @tcount=convert(varchar(50),count(*)) from @tbl_name ")
select @txt=@tbl_name+" count "+@tcount
print @txt

Error Message
*************
Server Message: Number 137, Severity 15
Server 'APPSDEV', Line 1:
Must declare variable '@tcount'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top