Tuesday, December 4, 2007

How to use set in MSSQL

How to use set in MSSQL

To use set in MSSQL

Here’s an example of the codes that allows us to do set in SQL

SELECT * FROM MYTBL WHERE USERID IN (5, 6, 7, 8, 9, 10)

By using this we are able to reduce a lot of coding such is OR , IF and FOR

Similarly, if we want to delete we can do the following

DELETE FROM mytbl
WHERE USERID IN (5, 6, 7)

No comments: