October 26, 2011

Function can be used with IN clause

Function result can be checked with IN clause in SQL Server.
Sometimes we stuck in some situation where it will be more
helpful.
CREATE TABLE TestD
(ID INT,Val NVARCHAR(50))
INSERT INTO TestD
SELECT 1,'SW11131' UNION ALL
SELECT 2,'WR11131' 
SELECT * FROM TestD
WHERE  
SUBSTRING(Val,1,2) IN ('SW','RW') 
'SW','RW') 

That’s It.
Enjoy Learning.

No comments:

Post a Comment