Friday, July 29, 2005
SOME, ANY, ALL are NOT new Features
This more of a Whats not new rather than Whats NEW.
I had seen many authentic links like this and even the book Introducing Microsoft SQL Server(TM) 2005 for Developers saying that SOME, ANY, ALL are new T-SQL extensions in SQL Server 2005. But the fact is that they are present in SQL Server 200 also.
See the below code samples, executed from Query Analyser, using the pubs database, in SQL Server 2000
USE PUBS
GO
SELECT * FROM Titles WHERE Type = 'business'
AND price > SOME(SELECT Price FROM Titles WHERE Type = 'psychology')
SELECT * FROM Titles WHERE Type = 'business'
AND price > ANY(SELECT Price FROM Titles WHERE Type = 'psychology')
SELECT * FROM Titles WHERE Type = 'business'
AND price > ALL(SELECT Price FROM Titles WHERE Type = 'psychology')
I had seen many authentic links like this and even the book Introducing Microsoft SQL Server(TM) 2005 for Developers saying that SOME, ANY, ALL are new T-SQL extensions in SQL Server 2005. But the fact is that they are present in SQL Server 200 also.
See the below code samples, executed from Query Analyser, using the pubs database, in SQL Server 2000
USE PUBS
GO
SELECT * FROM Titles WHERE Type = 'business'
AND price > SOME(SELECT Price FROM Titles WHERE Type = 'psychology')
SELECT * FROM Titles WHERE Type = 'business'
AND price > ANY(SELECT Price FROM Titles WHERE Type = 'psychology')
SELECT * FROM Titles WHERE Type = 'business'
AND price > ALL(SELECT Price FROM Titles WHERE Type = 'psychology')