Groups | Blog | Home
all groups > sql server (microsoft) > october 2007 >

sql server (microsoft) : What are these queries used for?


Mukesh_Singh_Nick NO[at]SPAM yahoo.com
10/17/2007 6:44:57 AM
I've come accross queries like this one previously but never got the
time to carefully study them form some book.

SELECT 1 WHERE 1 = 1


1) What do queries like these mean? From common sense, I can deduce
that it is some kind of a test for a boolean value, but the result is
already deterministic in the above case (true).

What use is such a query for?

2) What dialect of SQL (ANSI/T-SQL) does MS-SQL Server use?
Steve215
10/17/2007 3:52:15 PM
[quoted text, click to view]

The where clause 'WHERE 1=1' simply returns all rows since 1=1 is
always true.
Arto V Viitanen
10/20/2007 3:52:30 PM
Mukesh_Singh_Nick@yahoo.com kirjoitti:
[quoted text, click to view]

I think I have seen similarly queries on some general graphical query
tool. It uses the statement to check that

1) the database driver you named is working
2) the database name you gave is working
3) the username you gave is working

--
AddThis Social Bookmark Button