/ Published in: SQL
Expand |
Embed | Plain Text
BEGIN DECLARE @MailDelivery int, @EmailDelivery int, @FaxDelivery int, @ParamVal int, @ZeroVal int SET @MailDelivery = 1 --(0001) SET @EmailDelivery = 2 --(0010) SET @FaxDelivery = 4 --(0100) SET @ParamVal = 1 SET @ZeroVal = 0 IF @ParamVal = 0 SET @ZeroVal = NULL SET @ParamVal = isnull(@ParamVal, 0) SELECT Id, --BusinessEventDate, DeliveryFlags, (isnull(DeliveryFlags,0) & @ParamVal) AS BitMask FROM Mailsets WHERE (BusinessEventDate > '8/28/2007') --Check the appropriate bit. AND ( (isnull(DeliveryFlags,0) & @ParamVal) = @ParamVal + isnull(@ZeroVal, isnull(DeliveryFlags,0)) ) END GO
You need to login to post a comment.
