🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Problem with parameters and like

#4613
From: Formentz
Date: Wed, 07 Nov 2001 15:02
14 lines
1392 bytes
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: <3be94be1_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!newsfeed.mesh.ad.jp!uunet!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,644e5decabded7eb,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2001-11-07 07:03:04 PST
From: "Formentz" <francesco@leotron.com>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Problem with parameters and like
Date: Wed, 7 Nov 2001 16:02:06 +0100
Lines: 16
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
NNTP-Posting-Host: 80.16.99.17
Message-ID: <3be94be1_1@dnews>
X-Trace: dnews 1005145057 80.16.99.17 (7 Nov 2001 06:57:37 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!newsfeed.mesh.ad.jp!uunet!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews