Avatar of ebertsys
Flag for Germany

asked on 

I want get the value from Exec(@sql) and assign to @Rowcount(int)

i have a query built in the Parameter@sql
and i Need the result in a variable

what i have:
Declare  @Table varchar(50)
declare @Rowcount int

set @table = 'Persons'

set @sql = N'(select  @Rowcount= count(*) as from ' + @Table + ')'
exec sp_executesql @sql,'@Rowcount int output', @Rowcount Output

i get the error
Die Prozedur erwartet den Parameter "@params" vom Typ "ntext/nchar/nvarchar".
the procedure expected a Parameter "@param" of type "ntext/nchar/nvarchar"
Microsoft SQL Server

Avatar of undefined
Last Comment

8/22/2022 - Mon