Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
lazydev
Starting Member
16 Posts |
Posted - 2008-04-07 : 14:06:18
|
| my stored procedure is create procedure t1 (@a int,@b int,@c int,@d int,@e int,@f int)asbeginselect no,name,department from emp where a = @a and b =@b orc =@c ord = @d or e = @e or f = @fendmy problem is while executing i may get null values as input to the stored procedure .how to validate them ? any ideas .are there any arrays.if c and d are null then my condition would bewhere a = @a and b =@b or e = @e or f = @fhow many loops shall i have to write. |
|
|
jhocutt
Constraint Violating Yak Guru
385 Posts |
Posted - 2008-04-07 : 14:17:40
|
| where IsNull(@a, a) = aand IsNull(@b, b) = band etc"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking |
 |
|
|
lazydev
Starting Member
16 Posts |
Posted - 2008-04-07 : 14:22:30
|
quote: Originally posted by jhocutt where IsNull(@a, a) = aand IsNull(@b, b) = band etc"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking
if the value of a or b or c is null it should not be in select criteria.rest all should be there |
 |
|
|
jhocutt
Constraint Violating Yak Guru
385 Posts |
Posted - 2008-04-07 : 14:26:04
|
| That is basically what that will accomplish. If it is null it will compare the column with its self."God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
|
|
|
|
|
|