IF NOT EXISTS
(
SELECT 1
FROM [dbo].[tblTable01]
WHERE column01 = '123'
)
BEGIN;
INSERT INTO tblTable01([column01],[column02]) VALUES (123,'Book123');
END;
ELSE PRINT '123 RECORD EXISTS IN tblTable01';
GO
IF NOT EXISTS
(
SELECT 1
FROM [dbo].[tblTable01]
WHERE column01 = '123'
)
BEGIN;
INSERT INTO tblTable01([column01],[column02]) VALUES (123,'Book123');
END;
ELSE PRINT '123 RECORD EXISTS IN tblTable01';
GO
Comments