🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #4621

Re: Problem with parameters and like

#4621
From: Arnie Mauer
Date: Thu, 08 Nov 2001 17:29
28 lines
1699 bytes
Hi,

I think you're ending up with too many apostrophes.
Try it this way:
select * from Table1 where Field1 like 'some% + :p_other + %'

- Arnie

"Formentz" <francesco@leotron.com> wrote in message news:3be94be1_1@dnews...
> Hi all,
> I have a problem with the like statement in SQL Server, and the
parameters.
> I would like to do a query like this :
> select * from Table1 where Field1 like 'some%' + :p_other + '%'
> but when I set the parameter and try to open the query, it returns no
result
> set, even if the table contains the data I am searching.
> I know I can concatenate the parameter in the string at runtime, but if
the
> user inserts a ' character I am lost, the query will error.
>
> Anyone got a thing like this work?
>
> TIA
> Ciao
>     Formentz
>
>
Technical Details
Message-ID: <3beac109_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.media.kyoto-u.ac.jp!newsfeed.mesh.ad.jp!uunet!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews
References: <3be94be1_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,644e5decabded7eb
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2001-11-08 09:35:01 PST
From: "Arnie Mauer" <amauer@vrms.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3be94be1_1@dnews>
Subject: Re: Problem with parameters and like
Date: Thu, 8 Nov 2001 12:29:45 -0500
Lines: 30
Organization: VRMS
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 209.140.211.97
Message-ID: <3beac109_2@dnews>
X-Trace: dnews 1005240585 209.140.211.97 (8 Nov 2001 09:29:45 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.media.kyoto-u.ac.jp!newsfeed.mesh.ad.jp!uunet!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews