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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -