Yes this exception will come back from either the SQL you sent to the database or from the stored procedure you called.
My guess is you may be building out dynamic SQL or casting some type and the syntax is incorrect. If you are dynamically building TSQL in a stored proc, make sure the variable holding the SQL is large enough to build the entire statement.
You can also use a SQL trace if you are having trouble finding out the SQL being sent to the db from a stored proc containing parameters.
If the SQL is in code, just place a breakpoint where it is generated and run it manually against SQL server to see where the issue occurs.
atconway
All-Star
16846 Points
2756 Posts
Re: Incorrect syntax near 'nvarchar'.
Oct 23, 2009 04:31 PM|LINK
Yes this exception will come back from either the SQL you sent to the database or from the stored procedure you called.
My guess is you may be building out dynamic SQL or casting some type and the syntax is incorrect. If you are dynamically building TSQL in a stored proc, make sure the variable holding the SQL is large enough to build the entire statement.
You can also use a SQL trace if you are having trouble finding out the SQL being sent to the db from a stored proc containing parameters.
If the SQL is in code, just place a breakpoint where it is generated and run it manually against SQL server to see where the issue occurs.