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

Stuart McLachlan stuart at lexacorp.com.pg
Tue May 15 21:46:49 CDT 2007


IN() needs a delimited list. It doesn't understand REGEX.

I would assume that since the list would be shorter, NOT IN() would 
be slightly faster in this case - less comparisons to make on each 
record.



On 15 May 2007 at 22:34, jwcolby wrote:

> I am trying to process a query where an income field has a set of possible
> values, 1-9 and A-T.  The client wants values 409 and A-M.  Logically that
> would be more efficient if it was NOT in(1-3,n-t).  Is it in fact more
> efficient?  And can ranges like that be specified or do I need to use comma
> delimted lists 1,2,3,n,o,p...?
> 
> John W. Colby
> Colby Consulting
> www.ColbyConsulting.com
> 
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
> 





More information about the dba-SQLServer mailing list