/ Published in: SQL
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
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
Comments
 Subscribe to comments
                    Subscribe to comments
                
                