troubleshooting Question

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

Avatar of ebertsys
ebertsysFlag for Germany asked on
Microsoft SQL Server
2 Comments1 Solution68 ViewsLast Modified:
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"
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros