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'.
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'.