How to make such as: IF (table if exists types) THEN ... END ?
Asked
Active
Viewed 330 times
-2
-
2search for your title on google and you will find tons of solutions to your question – Lelio Faieta May 28 '18 at 13:37
-
Possible duplicate of [Check if table exists in SQL Server](https://stackoverflow.com/questions/167576/check-if-table-exists-in-sql-server) – Mohamed Thasin ah May 28 '18 at 14:16
1 Answers
0
Try this:
SELECT COUNT(*)
FROM information_schema.tables
WHERE table_schema = '[database name]'
AND table_name = '[table name]';
Save the result and you can use it in an if statement

Snipezzzx
- 26
- 7