Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'.
I just re-factored an SQL Server stored procedure to use sp_executesql. Lots of cut and paste. It looked almost identical to a sibling stored procedure, at least in terms of local variable declarations and parameter list declaration. So why, where the sibling stored procedure returned results, did this stored procedure generate this error message?
Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'
Richard Dudley had the answer. I had inadvertently declared my @queryStr variable as varchar
instead of nvarchar
.