SQL Server/T-SQL Tutorial/Data Convert Functions/NULLIF
Версия от 13:46, 26 мая 2010; (обсуждение)
Returning a NULL Value When Two Expressions Are Equal: Otherwise Return the First Expression
5> DECLARE @Value1 int
6> DECLARE @Value2 int
7> SET @Value1 = 55
8> SET @Value2 = 955
9> SELECT NULLIF(@Value1, @Value2)
10> GO
-----------
55
(1 rows affected)
1>
2>
3> DECLARE @Value1 int
4> DECLARE @Value2 int
5> SET @Value1 = 55
6> SET @Value2 = 55
7> SELECT NULLIF(@Value1, @Value2)
8> GO
-----------
NULL
(1 rows affected)
1>