-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUSERS_DROP.sql
More file actions
29 lines (25 loc) · 866 Bytes
/
USERS_DROP.sql
File metadata and controls
29 lines (25 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
-------------------------------------------------------------------------------------------------
-- USERS_DROP
-------------------------------------------------------------------------------------------------
SET NOCOUNT ON;
SET ANSI_NULLS ON;
SET QUOTED_IDENTIFIER ON;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
DECLARE @IS_COMMIT BIT = 0;
-------------------------------------------------------------------------------------------------
USE VideoHosting;
BEGIN TRAN
PRINT N'➕ JOB IS STARTED';
IF NOT EXISTS (SELECT 1 FROM [sys].[tables] WHERE [name] = N'USERS') BEGIN
PRINT N'❌ TABLE [USERS] WAS NOT FOUND';
END ELSE BEGIN
DROP TABLE IF EXISTS [USERS];
PRINT N'➕ DROP TABLE [USERS] IS COMPLETED';
END;
IF (@IS_COMMIT = 1) BEGIN
COMMIT TRAN
PRINT N'➕ DROP IS COMMITTED'
END ELSE BEGIN
ROLLBACK TRAN
PRINT N'❌ DROP IS ROLL-BACKED'
END;