Generic Select Doesn't Work With Bit Type
based on this answer i tryed to create a Select for on of my table ALTER PROCEDURE _Einrichtung_Select -- Parameters with default values @EinrichtungId AS int
Solution 1:
It's because you can have null as values of your columns. And SQL have three-value logic, so checking null = null will return UNKNOWN instead of TRUE (as you may expect).
I think this query will help you:
select *
frommyTablewhere
(@EinrichtungId is null or EinrichtungId = @EinrichtungId) and
(@EinrichtungName is null or EinrichtungName = @EinrichtungName) and
(@IsKueche is null or IsKueche = @IsKueche) and
(@RefEinrichtungId is null or RefEinrichtungId = @RefEinrichtungId) and
(@RefSpeiseplantypId is null or RefSpeiseplantypId = @RefSpeiseplantypId)
Post a Comment for "Generic Select Doesn't Work With Bit Type"