Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
4.5 kB
2
Indexable
Never
DECLARE @tabel1 VARCHAR(100) = '[bsi].[ddm].[masterDPK_BSI_20210531]';
DECLARE @tabel2 VARCHAR(100) = '[bsi].[ddm].[masterDPK_BSI_20210630]';
DECLARE @tabel3 VARCHAR(100) = '[bsi].[ddm].[masterDPK_BSI_20210730]';
DECLARE @tabel4 VARCHAR(100) = '[bsi].[ddm].[masterDPK_BSI_20210831]';
DECLARE @tabel5 VARCHAR(100) = '[bsi].[ddm].[masterDPK_BSI_20210930]';
DECLARE @tabel6 VARCHAR(100) = '[bsi].[ddm].[masterDPK_BSI_20211029]';
DECLARE @tabel7 VARCHAR(100) = '[bsi].[ddm].[masterDPK_BSI_20211130]';
DECLARE @tabel8 VARCHAR(100) = '[bsi].[ddm].[masterDPK_BSI_20211231]';
DECLARE @tabel9 VARCHAR(100) = '[bsi].[ddm].[masterDPK_BSI_20220131]';
DECLARE @tabel10 VARCHAR(100) = '[bsi].[ddm].[masterDPK_BSI_20210228]';
DECLARE @tabel11 VARCHAR(100) = '[bsi].[ddm].[masterDPK_BSI_20210331]';
DECLARE @tabel12 VARCHAR(100) = '[bsi].[ddm].[masterDPK_BSI_20210429]';

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @tabel1)
    SELECT CONCAT('Tabel ', @tabel1, ' ada.') AS result
ELSE
    SELECT CONCAT('Tabel ', @tabel1, ' tidak ditemukan.') AS result

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @tabel2)
    SELECT CONCAT('Tabel ', @tabel2, ' ada.') AS result
ELSE
    SELECT CONCAT('Tabel ', @tabel2, ' tidak ditemukan.') AS result

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @tabel3)
    SELECT CONCAT('Tabel ', @tabel3, ' ada.') AS result
ELSE
    SELECT CONCAT('Tabel ', @tabel3, ' tidak ditemukan.') AS result

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @tabel4)
    SELECT CONCAT('Tabel ', @tabel4, ' ada.') AS result
ELSE
    SELECT CONCAT('Tabel ', @tabel4, ' tidak ditemukan.') AS result

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @tabel5)
    SELECT CONCAT('Tabel ', @tabel5, ' ada.') AS result
ELSE
    SELECT CONCAT('Tabel ', @tabel5, ' tidak ditemukan.') AS result

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @tabel6)
    SELECT CONCAT('Tabel ', @tabel6, ' ada.') AS result
ELSE
    SELECT CONCAT('Tabel ', @tabel6, ' tidak ditemukan.') AS result

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @tabel7)
    SELECT CONCAT('Tabel ', @tabel7, ' ada.') AS result
ELSE
    SELECT CONCAT('Tabel ', @tabel7, ' tidak ditemukan.') AS result

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @tabel7)
    SELECT CONCAT('Tabel ', @tabel7, ' ada.') AS result
ELSE
    SELECT CONCAT('Tabel ', @tabel7, ' tidak ditemukan.') AS result

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @tabel8)
    SELECT CONCAT('Tabel ', @tabel8, ' ada.') AS result
ELSE
    SELECT CONCAT('Tabel ', @tabel8, ' tidak ditemukan.') AS result

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @tabel9)
    SELECT CONCAT('Tabel ', @tabel9, ' ada.') AS result
ELSE
    SELECT CONCAT('Tabel ', @tabel9, ' tidak ditemukan.') AS result

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @tabel10)
    SELECT CONCAT('Tabel ', @tabel10, ' ada.') AS result
ELSE
    SELECT CONCAT('Tabel ', @tabel10, ' tidak ditemukan.') AS result

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @tabel11)
    SELECT CONCAT('Tabel ', @tabel11, ' ada.') AS result
ELSE
    SELECT CONCAT('Tabel ', @tabel11, ' tidak ditemukan.') AS result

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @tabel12)
    SELECT CONCAT('Tabel ', @tabel12, ' ada.') AS result
ELSE
    SELECT CONCAT('Tabel ', @tabel12, ' tidak ditemukan.') AS result
 


-- .. .. .. .. ##
DECLARE @tabel1 VARCHAR(100) = '[bsi].[mis].[ds_az_account_n_eom_20210531]';
DECLARE @tabel2 VARCHAR(100) = '[bsi].[mis].[ds_az_account_n_eom_20210630]';
DECLARE @tabel3 VARCHAR(100) = '[bsi].[mis].[ds_az_account_n_eom_20210730]';
DECLARE @tabel4 VARCHAR(100) = '[bsi].[mis].[ds_az_account_n_eom_20210831]';
DECLARE @tabel5 VARCHAR(100) = '[bsi].[mis].[ds_az_account_n_eom_20210930]';
DECLARE @tabel6 VARCHAR(100) = '[bsi].[mis].[ds_az_account_n_eom_20211029]';
DECLARE @tabel7 VARCHAR(100) = '[bsi].[mis].[ds_az_account_n_eom_20211130]';
DECLARE @tabel8 VARCHAR(100) = '[bsi].[mis].[ds_az_account_n_eom_20211231]';
DECLARE @tabel9 VARCHAR(100) = '[bsi].[mis].[ds_az_account_n_eom_20220131]';
DECLARE @tabel10 VARCHAR(100) = '[bsi].[mis].[ds_az_account_n_eom_20210228]';
DECLARE @tabel11 VARCHAR(100) = '[bsi].[mis].[ds_az_account_n_eom_20210331]';
DECLARE @tabel12 VARCHAR(100) = '[bsi].[mis].[ds_az_account_n_eom_20210429]';
Leave a Comment