April 17, 2012

How to use ANY keyword in SQL Server

ANY keyword can be very useful in certain cases.
I have tried to create one example here to show you how can we use this
in our day to day queries.


CREATE TABLE PostDetails
(
                ID INT, PostDate DATE,TNP INT
)
;
Go
INSERT INTOPostDetails
 VALUES
  (1, '2012/4/1',5),
  (2, '2012/4/2',10),
  (3, '2012/4/3',15)
GO
SELECT * FROM PostDetails
WHERE '2012/4/2' =ANY(SELECTPostDate FROM PostDetails);


That's It.
Enjoy Learning.

No comments:

Post a Comment