if only SQL Server 2005 would bring this feature…

Ok, add this to my Christmas’ wish list. SQL Server 2000 doesn’t allow where … in clauses with multiple fields, so the following construction fails:

DELETE FROM temp1
WHERE name, description IN
(SELECT name,description
FROM temp2
WHERE name LIKE ‘%computers%’)

The solution is a not so pretty concatenation, if fields are strings

DELETE FROM temp1
WHERE name + description IN
(SELECT name + description
FROM temp2
WHERE name LIKE ‘%computers%’)

But you are forced to use joins if the field is numerical.

I’ve been receiving a training from INETA as part of SQL 2005 launch this November, I’m planning to ask if they have included any extra features in the new T-SQL, that one would be pretty handy.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.