jeudi 8 novembre 2018

If exists many tables

This may sound stupid, but I would like to know if there is a way to verify if a list of tables exists before doing an action. If I have 12 tables to verify, do I have to repeat “If exists bla bla bla” 12 times? I tried doing …

IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES 
WHERE TABLE_NAME = ’employee_id’
and TABLE_NAME = N’employee_address’
and TABLE_NAME = N’employee_division’ )

But it not working. Any idea?

Aucun commentaire:

Enregistrer un commentaire