[dba-SQLServer] IN() or NOT IN()

jwcolby jwcolby at colbyconsulting.com
Wed May 16 09:17:24 CDT 2007


Yep, I tried it yesterday.  Comma delimited list was all I could make
happen. 


John W. Colby
Colby Consulting
www.ColbyConsulting.com
-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Francisco
Tapia
Sent: Wednesday, May 16, 2007 9:22 AM
To: dba-sqlserver at databaseadvisors.com
Subject: Re: [dba-SQLServer] IN() or NOT IN()

It definatly (in sql 2000) only takes list or single column subqueries.
I'm not at my pc right now or I'd try that query on ss2005

On 5/15/07, Stuart McLachlan <stuart at lexacorp.com.pg> wrote:
> Are you sure? I've never seen anything that says that IN() takes 
> anything other than a Subquery or a List of expressions.
>
> The SQL Server 2000 that I have here returns:
> "Invalid column name 4-9" if I try that.
>
> On 15 May 2007 at 19:44, kens.programming wrote:
>
> > You shouldn't have to use a comma limited list, just square brackets 
> > to designate your sets.
> >
> > IN ([4-9], [A-M])
> > IN ([^1-3], [^N-T])
> > NOT IN ([1-3], [N-T])
> > NOT IN ([^4-9], [^A-M])
> >
> > Ken




More information about the dba-SQLServer mailing list