Article View: borland.public.interbase.sql
Article #11310Re: LIKE command with NUMERIC field?
From: Martijn Tonies
Date: Wed, 27 Nov 2002 12:55
Date: Wed, 27 Nov 2002 12:55
48 lines
2263 bytes
2263 bytes
Hi, What if you CAST it to VARCHAR first? WHERE CAST(mynumericfield AS VARCHAR(10)) LIKE '10%' Actually, upon testing, it works fine with a database I have... ?! select * from BESTELLING where bestellingid like '111%' Returns rows alright... -- With regards, Martijn Tonies InterBase Workbench - the developer tool for InterBase http://www.upscene.com Upscene Productions http://www.upscene.com "This is an object-oriented system. If we change anything, the users object." > A few questions about LIKE and NUMERIC fields :- > > 1) We currently use LIKE with some of our NUMERIC fields. I know this is not > how it should be used, so can anyone give a method to do such comparisons > with NUMERIC fields? I need to be able to find NUMERICs starting with say 10 > (like 10, 101, 10201 etc.). > > 2) This used to work fine with IB 5.6. I've just upgraded to IB 6.5 and now > the problem seems to be that I need to include a space in front of the value > I'm looking for. eg. LIKE ' 10%' (LIKE '10%' worked fine in IB5.6). Negative > values work fine eg. LIKE '-10%'. Any ideas about this? (I tried a LIKE > '+10%' to no avail.) > > Hope my questions make sense. > > Regards, > Kevin Naidoo > M.Ying and Associates > >
Technical Details
Message-ID:
<3de4c04c@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!nntp2.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3de4b7fe@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114a0e,9a9504f897cb3591 X-Google-Attributes: gid114a0e,public X-Google-ArrivalTime: 2002-11-27 05:06:17 PST From: "Martijn Tonies" <m.tonies@upscene_remove.com> Newsgroups: borland.public.interbase.sql References: <3de4b7fe@newsgroups.borland.com> Subject: Re: LIKE command with NUMERIC field? Date: Wed, 27 Nov 2002 13:55:58 +0100 Lines: 50 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 212.238.179.102 Message-ID: <3de4c04c@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1038401612 212.238.179.102 (27 Nov 2002 04:53:32 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!nntp2.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail