Apr 12, 2004 #1 ghost2 Programmer Aug 7, 2003 145 US How do you surround a single quote in an exec command to get it to stay as a single quote and not close the string?
How do you surround a single quote in an exec command to get it to stay as a single quote and not close the string?
Apr 12, 2004 #2 MartinCroft Programmer Jun 12, 2003 151 GB Hi if your building dynamic sql within a string and want ' to be displayed as ' then add addtional '' E.G DECLARE @test varchar(100) DECLARE @text varchar(100) SET @text='microsoft' SET @test ='Select * from orders where company = ' + '''' +@text+'''' PRINT @test Upvote 0 Downvote
Hi if your building dynamic sql within a string and want ' to be displayed as ' then add addtional '' E.G DECLARE @test varchar(100) DECLARE @text varchar(100) SET @text='microsoft' SET @test ='Select * from orders where company = ' + '''' +@text+'''' PRINT @test