Skip to main content

Posts

Showing posts from June, 2010

LIKE in sp_executesql

If somebody wants to use LIKE in sp_executesql if you use syntax as follows it will give an error. Wrong Syntax: LIKE N''%'' @variableName ''%'' Error message received; Msg 102, Level 15, State 1, Line 24 Incorrect syntax near '%'. Correct Syntax: LIKE N''%'' + @variableName + ''%'' Have to double the quotes as well as '+' marks around the variable.