Заголовок



DECLARE @TypeID INT
SET @TypeID = 2

SELECT
CASE
        WHEN @TypeID = 0 THEN 'Тип=0'
        WHEN @TypeID = 1 THEN 'Тип=1'
        ELSE 'х.з.' END



IF NOT EXISTS (SELECT * FROM tab1 WHERE Param1 = 10)
BEGIN
        PRINT 'NOT EXISTS'
END



DECLARE @DateBegin datetime
DECLARE @DateEnd datetime

SET @DateBegin = 'aug 15 1969'
SET @DateEnd = 'aug 16 1969'

IF DATEDIFF(DAY, @DateBegin, @DateEnd) <> 1
BEGIN
    DECLARE @@DateBegin varchar(11)
    DECLARE @@DateEnd varchar(11)

    SET @@DateBegin = CAST(@DateBegin AS varchar(11))
    SET @@DateEnd = CAST(@DateEnd AS varchar(11))

    RAISERROR ('Разница между ''%s '' и ''%s '' не равна 1', 16, 1, @@DateBegin, @@DateEnd)
    RETURN
END