2007/06/14

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.

4 comments:

Julián Rivera said...

'Doh!' Thankyou!!!

Pankaj Tambe said...

@statement parameter means your SQL query variable.And it should be always either ntext/nchar/nvarchar.Check Whether you have declare your sql string variable as "nVARCHAR".
Thanks.
-Pankaj Tambe.

Mitch said...

@Pankaj, yes, that's it exactly. (See the last sentence of the post.)

Unknown said...

Thank You So Much U SAVED MY DAY.