Skip to content
Advertisement

Declaring A variable inside dynamic ssql

I have the following string and would like to replace >30 at the end of the string with @value so I can pass it through a stored procedure. How do I declare @value. My orginal code had >35′ in place of vaule and worked fine. Thanks in advance.

Advertisement

Answer

You want sp_executesql().

Read through the documentation in the link; it covers how to do this in detail.

The other thing to be aware of is you may need to include the > operator from your >35 as part of the string literal.

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