May 17, 2004 #1 paultasy Technical User Joined May 12, 2004 Messages 5 Location GB Here's a quick one,,, I have multiple values that I want to check are all NULL to trigger a condition.... Currently it's and A=NULL and B=NULL and C=NULL and D=NULL etc etc.... Is there anyway to write the same as something like: and (A,B,C,D=NULL)? Thanks
Here's a quick one,,, I have multiple values that I want to check are all NULL to trigger a condition.... Currently it's and A=NULL and B=NULL and C=NULL and D=NULL etc etc.... Is there anyway to write the same as something like: and (A,B,C,D=NULL)? Thanks
May 17, 2004 #2 PHV MIS Joined Nov 8, 2002 Messages 53,708 Location FR IMHO, the correct way is: and A IS NULL and B IS NULL and C IS NULL and D IS NULL etc etc.... Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244 Upvote 0 Downvote
IMHO, the correct way is: and A IS NULL and B IS NULL and C IS NULL and D IS NULL etc etc.... Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
May 17, 2004 Thread starter #3 paultasy Technical User Joined May 12, 2004 Messages 5 Location GB thanks for that, however, what I am really trying to achieve is to shorten the code if possible? Upvote 0 Downvote
May 17, 2004 #4 swampBoogie Programmer Joined Jan 6, 2003 Messages 1,660 Location SE Depending on your DBMS, the following may be allowed. Code: where (a,b,c,d) is null Upvote 0 Downvote
May 17, 2004 Thread starter #5 paultasy Technical User Joined May 12, 2004 Messages 5 Location GB doesn't work in Sybase - oh well, never mind. The code isn't too cumbersome so I'll stick with the original form! Thanks for looking anyway Upvote 0 Downvote
doesn't work in Sybase - oh well, never mind. The code isn't too cumbersome so I'll stick with the original form! Thanks for looking anyway
May 17, 2004 #6 jimbopalmer Programmer Joined Jul 20, 2001 Messages 2,904 Location US I am not near my database, but does WHERE a||b||c||d is null; work? in Oracle that should concatinate the 4 variables into a single value and test the single value I tried to remain child-like, all I acheived was childish. Upvote 0 Downvote
I am not near my database, but does WHERE a||b||c||d is null; work? in Oracle that should concatinate the 4 variables into a single value and test the single value I tried to remain child-like, all I acheived was childish.
May 17, 2004 Thread starter #7 paultasy Technical User Joined May 12, 2004 Messages 5 Location GB Great - that works fine! Neater code!! Upvote 0 Downvote
May 17, 2004 #8 PHV MIS Joined Nov 8, 2002 Messages 53,708 Location FR Be aware that WHERE a||b||c||d is null is true then only one of a,b,c or d is null, which is not the same logic as the original post. Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244 Upvote 0 Downvote
Be aware that WHERE a||b||c||d is null is true then only one of a,b,c or d is null, which is not the same logic as the original post. Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
May 17, 2004 Thread starter #9 paultasy Technical User Joined May 12, 2004 Messages 5 Location GB don't worry, I stuck brackets around it: and (lbl_bp_cd || pd_cd || cat_it_cd || pric_cd || convert(varchar,age_restr) || profit_ctr_cd || rptr_grp_cd || series_grp_cd) is NULL Upvote 0 Downvote
don't worry, I stuck brackets around it: and (lbl_bp_cd || pd_cd || cat_it_cd || pric_cd || convert(varchar,age_restr) || profit_ctr_cd || rptr_grp_cd || series_grp_cd) is NULL
May 17, 2004 #10 PHV MIS Joined Nov 8, 2002 Messages 53,708 Location FR This where clause will not have the same behaviour as the original post. Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244 Upvote 0 Downvote
This where clause will not have the same behaviour as the original post. Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244