I'm not sure what you're trying to do; obviously, the simple answer would be to eliminate the WHERE clause.
But I'm sure you have a reason for asking, so:
* if you can control the entire boolean statement, then you could use: [tt]where 1 = 1[/tt]
* if you must use the column name, and the column does not allow NULL values, you could use: [tt]where fldName is not NULL[/tt]
-----------------
Robert Bradley
use coupon code "TEKTIPS" for 15% off at:
If you want all the records just do:
Select fldname from tablename. Leave off the where condition.
If you want only specific records from the table then specify a criteria in your where statement:
where fldname = 'John Doe'
You can also use WHERE fldName=fldName which is more effiecient than WHERE fldName Is Not Null. But as noted the WHERE is not necessary. Terry L. Broadbent FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
In addition to the ORIGINAL massage i posted:
i'm calling a sproc (from ASP) that contains a query
of the format i've indicated above and contains a condition of the type:
WHERE fldName1 = @param1
AND fldName2 = @param2
! NOTICE that the condition must be "="
and i was wondering if i can send any parameter that will
cause all records selection
(sending the field name as parameter doesn't work cause the field data type is int and i get a conversion Error)
i've solved my problem by sending @param = NULL values for parameters i want to disable from the where codition
and using WHERE fldName = IsNull(@param,fldName)
in the Condition
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.