When you try to execute sp_executesql you get the below error:


Msg 214, Level 16, State 2, Procedure sp_executesql, Line 1
Procedure expects parameter ‘@statement’ of type ‘ntext/nchar/nvarchar’.

Fix:
Add N Before the sql query.

Before:
[sql]
EXEC sp_executesql ‘SELECT 1′
[/sql]

After:
[sql]
EXEC sp_executesql N’SELECT 1’
[/sql]

Applies to SQL Server 2000,SQL Server 2005,SQL Server 2008,SQL Server 2008 r2,SQL Server 2012, SSIS

Leave a Reply

Your email address will not be published. Required fields are marked *