|  | Posted by Tom Moreau on 09/20/05 15:15 
Typo:
 SELECT @strsql = 'SELECT * FROM tblTest WHERE Field1 Like ''blah'''
 
 
 --
 Tom
 
 ----------------------------------------------------
 Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
 SQL Server MVP
 Columnist, SQL Server Professional
 Toronto, ON   Canada
 www.pinpub.com
 ..
 "Tom Moreau" <tom@dont.spam.me.cips.ca> wrote in message
 news:eZ0HNxdvFHA.3000@TK2MSFTNGP12.phx.gbl...
 Use single-quotes to delimit the string.  Use double single-quotes inside
 the string:
 
 SELECT @strsql = ''SELECT * FROM tblTest WHERE Field1 Like ''blah'''
 
 
 --
 Tom
 
 ----------------------------------------------------
 Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
 SQL Server MVP
 Columnist, SQL Server Professional
 Toronto, ON   Canada
 www.pinpub.com
 ..
 "Steve" <steve@hello.com> wrote in message news:432ff8b5_3@x-privat.org...
 How do I get a single quote (') in a NVARCHAR string in MS SQL Server?
 
 e.g. SELECT @strsql = "SELECT * FROM tblTest WHERE Field1 Like 'blah''
 
 Obviously this is invalid as the single quote before "blah" would end the
 varchar string.
 
 How do I get round this?
  Navigation: [Reply to this message] |