Skip to content
Advertisement

Stored procedure expects parameter ‘Incorrect syntax near ‘:’.’

I have the following stored procedure in SQL Server:

When I try to execute the stored procedure, I get the following error:

Incorrect syntax near ‘:’.

Do you know what would be the issue?

Advertisement

Answer

As pointed out in the comment on your question, there is no need for dynamic SQL in this stored procedure. You could just rewrite it:

Only use sp_executesql if you absolutely need to use it – here you do not need it.

Just to answer your question, here is what you could have done (but it is not advised in this simple scenario):

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement