🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: LIKE operator

#122
From: Erland Sommarskog
Date: Thu, 23 Mar 2000 00:00
20 lines
1679 bytes
[posted and mailed]

Jacob (jsilberstein@eazall.com) writes:
>I have a SQL Server 7 table who's primary key is a column of 'int' data
>type, I use int because I want it to be an Identity field, but I would like
>to create queries that use the LIKE operator to search for string patterns,
>but I keep getting errors because the LIKE operator works only with string
>data types. If anyone knows a workaround for this I would appreciate your
>help.

As BP Margolin said you can use convert, but what he didn't mention
is that there is performance penalty involved here. SQL Server
might opt for a table scan.

Since you didn't give any example, it's difficult to give good
advice, but maybe BETWEEN is useful.

-- 
Erland Sommarskog, Stockholm, sommar@algonet.se
This is an incomplete mess.
Technical Details
Message-ID: <8F00FD1C1Yazorman@194.213.69.152>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8bd80o$7sri$1@node17.cwnet.frontiernet.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff490,85bb05223c1e0dda
X-Google-Attributes: gidff490,public
X-Google-Thread: 11301e,85bb05223c1e0dda
X-Google-Attributes: gid11301e,public
X-Google-Thread: 104de1,85bb05223c1e0dda
X-Google-Attributes: gid104de1,public
From: sommar@algonet.se (Erland Sommarskog)
Subject: Re: LIKE operator
Date: 2000/03/23
Message-ID: <8F00FD1C1Yazorman@194.213.69.152>
X-Deja-AN: 601506234
References: <8bd80o$7sri$1@node17.cwnet.frontiernet.net>
Followup-To: comp.databases.ms-sqlserver
X-Complaints-To: abuse@algo.net
X-Trace: cubacola.tninet.se 953851835 9010 195.163.244.39 (23 Mar 2000 22:50:35 GMT)
Organization: BRF Beckasinen 13
User-Agent: Xnews/03.03.11
NNTP-Posting-Date: 23 Mar 2000 22:50:35 GMT
Newsgroups: comp.databases.ms-sqlserver,cz.comp.microsoft.sql,microsoft.public.sqlserver.programming