Monday 16 September 2019

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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...