🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.databases.ms-sqlserver
Article #147

Re: *&$^&%$ Double and single quote in same string

#147
From: Godzilla
Date: Wed, 22 Jul 1998 00:00
25 lines
1650 bytes
On Wed, 22 Jul 1998 15:55:18 -0400, "Tom" <somewhere@nospam.com>
wrote:

>In a stored procedure I am building a dynamic string to be executed.  One of
>the variables that is in the where statement has a double and a single quote
>in it.  In order to execute my string I need to place it in either single or
>double quotes but this will bomb if there are both in the string.  In oracle
>and Informix they have escape characters to get around this.
>
>Does SQL Server have some type of escape character to get around this.  Or
>is there some other type of work around.
>
>Thanks
>
>Tom
>
>

to hell with ecape characters.  double up where you want it to .
these work

select "O'Hara said ""Quote this, Batman"""
select 'O''Hara said "Quote this, Batman"'

paste this into wISQL, its a bit more readable there
Technical Details
Message-ID: <35b6646d.22693467@nntp.mbnet.mb.ca>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35b646c9.0@news.one.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f816f,58a0f30648015610
X-Google-Attributes: gidf816f,public
X-Google-Thread: ff490,58a0f30648015610
X-Google-Attributes: gidff490,public
X-Google-Thread: 11301e,58a0f30648015610
X-Google-Attributes: gid11301e,public
X-Google-Thread: 104de1,58a0f30648015610
X-Google-Attributes: gid104de1,public
From: bdondo@city.winnipeg.mb.ca (Godzilla)
Subject: Re: *&$^&%$ Double and single quote in same string
Date: 1998/07/22
Message-ID: <35b6646d.22693467@nntp.mbnet.mb.ca>
X-Deja-AN: 373988453
References: <35b646c9.0@news.one.net>
Organization: MBnet Networking Inc.
NNTP-Posting-Date: Wed, 22 Jul 1998 17:19:46 CDT
Newsgroups: comp.databases.ms-sqlserver,cz.comp.microsoft.sql,microsoft.public.sqlserver.misc,microsoft.public.sqlserver.programming