sqlserverbest
Programmer
How do print the value of variable @totsum
declare @totsum money, @sql varchar(1000)
set @sql = 'select @totsum = sum(price) from product'
execute(@sql)
print str(@totsum,15,2)
I am getting the message as @totsum not declared.
Your help is appreciated.
declare @totsum money, @sql varchar(1000)
set @sql = 'select @totsum = sum(price) from product'
execute(@sql)
print str(@totsum,15,2)
I am getting the message as @totsum not declared.
Your help is appreciated.