Quantcast
Channel: SQL.ru: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 7251

Побитовый оператор

$
0
0
+
DECLARE @i int;
SET @i = 1 | 5;

Update p
SET Flags = 3
From T_USERS as p
Where (p.Flags = @i & 1) AND DATEDIFF(month,p.LastPasswordChangeDate, GETDATE())>=4
Update p
SET Flags = 7
From T_USERS as p
Where (p.Flags = @i & 5) AND DATEDIFF(month,p.LastPasswordChangeDate, GETDATE())>=4


подскажите как можно оптимизировать, чтобы все было через один Update

Viewing all articles
Browse latest Browse all 7251

Trending Articles