Yep I have to mark this as answered as it answered exactly what I asked for and works a treat and will need it also but again I was unclear and again apologies and yes English is my only language. First thing I need to clear up is that my variable @intSourceID is always an integer value so that should simplify that select 'x' thing which is the first time I have seen that and still not sure how it works but read some other posts on it
When @intSourceID = 0 (that is, it has not been specified as a criteria) then I want all those rows that SourceID is Null only
When @intSourceID > 0 then I want the matching rows, however if there are no matching rows I want only the rows that the SourceID is null
so in your example
0 returns
Null a
2 returns
2 c
and 45 returns
Null a
in fact the first case of 0 is the same as the third case 45, so my previous edit should have read, return my matching records or else return the null records only
apologies again and thanking you for your patience
No comments:
Post a Comment