okay, so i know i'm totally just not thinking of something here, but i have a stored proc i'm trying to have work with a dynamic table name. i'm trying to get how many rows are in the table, how to a capture that from the Exec(@sql) command?
declare @tablename varchar(255) = '#temp'
declare @sql varchar(max)
declare @maxid varchar(30)
set @sql = 'select max(rec_no) maxid from ' + @tablename
exec(@sql)
any help would be great! thanks in advance!