views:

99

answers:

1

Query:

SELECT TOP 1 ReportInvoked , EmailSent
  FROM tblReportInvoker 
 WHERE WebUserId = 12345

This gives me two bit values. What I really want is a scalar result that is the logical AND of these two values. Is this possible? This seems like it would be easy but I'm not finding a syntax that will work.

Edit: Of course the flaw in my clever plan is that it will be true if both processes fail, so revised query to:

SELECT TOP 1 (ReportInvoked & EmailSent) & (1 & ReportInvoked) AS 'ReportSent'
FROM tblReportInvoker 
WHERE WebUserId = 12345
+6  A: 
SELECT TOP 1 ReportInvoked & EmailSent AS ReportSent FROM tblReportInvoker WHERE WebUserId = 12345

Bitwise AND operator in Transact-SQL

Chris McCall
... as ReportSent ...?
tvanfosson
Thanks. I was sure I had tried this, but evidently not... Putting out too many fires today.
Leslie
@tvanfosson there you go, bro
Chris McCall