June 19, 2002 at 3:00 am
Here is a where clause:
WHERE CDAPEN <> 'P'
I need to retrieve all rows with CDAPEN <> 'P' even if CDAPEN is NULL.
I would'nt use ISNULL(CDAPEN,'') function because we have a lot of column in this case and some of them are in DATETIME format.
Thank in advance for all answers.
June 19, 2002 at 3:38 am
Benoit ,
the best way to go about this would be using
((Col <> 'XYZ' ) AND (Col IS NULL)) in the where clause
this would utilize any indexes on the Column
ISNULL would probably make the where clause unsargeable ,
but you can get around the datetime issue by using
ISNULL(Col,DATEADD(dd,1,@DateVar)) = @DateVar
the SET ANSI_NULLS OFF option wouldnt work for you
June 19, 2002 at 5:40 am
Actually should be
((Col <> 'XYZ' ) OR (Col IS NULL)) so it can
be either situation or
COL != 'XYZ'
does the same.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
June 19, 2002 at 5:57 am
Antares,
you are right it should be OR instead of AND , my mistake
and it should be ISNULL(Col,DATEADD(dd,1,@DateVar)) <> @DateVar
but did not understand what you mean by
quote:
COL != 'XYZ'does the same.
June 19, 2002 at 4:33 pm
!= means not equal, NULL is not equal in comparison thus
Col != 'XYZ' will look for anything that does not equal 'XYZ'.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply