Friday 22 January 2016

sql server - TSQL Use ' in string assignment

Trying to use a single quote and assign it to a variable so I can create a dynamic report.




The problem is when I do this:



set @Statequery = (' and PostalState = ' ')  +  @PostalState  + '''


If you do this, print @Statequery, it needs it to look like this.



and postalState = 'QLD'



How do I escape the ' character in this case?



Thanks for your help in advanced,



Ryan

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...