sql - How to check if the table is exist in mssql -
how can check if multiple tables exist in ms-sql?
for example want check if these 5 tables exist:
(log_2017_06_01 , log_2017_06_02 , log_2017_06_03, log_2017_06_04, log_2017_06_05)
i want 5 tables each exist result sql.
how should that?
select * master.dbo.sysdatabases name = 'log_2017_06_01' select * master.dbo.sysdatabases name = 'log_2017_06_02' select * master.dbo.sysdatabases name = 'log_2017_06_03' select * master.dbo.sysdatabases name = 'log_2017_06_04' select * master.dbo.sysdatabases name = 'log_2017_06_05'
or simpler:
select * master.dbo.sysdatabases name 'log_2017_06_%'
and if want check of them exist:
select * master.dbo.sysdatabases name in ('log_2017_06_01','log_2017_06_02','log_2017_06_03','log_2017_06_04','log_2017_06_05')
Comments
Post a Comment