I have some SQL code that runs in query designer such as
SELECT CustomerName FROM Customers WHERE CustomerName=@CustomerName
(so a very simple query that gets the customer name from the customers table where the name is passed in)
I need to create a stored proc where the query above needs to be in single quotes but i need to separate the query with the parameter so SQL knows the parameter is being passed in.
I tried this
'SELECT CustomerName FROM Customers WHERE CustomerName=' + @CustomerName
but returned an error that the syntax is incorrect. How could i accomplish this?