I'm just learning how to write SQL queries. Reading manuals a& help like crazy but sometimes that doesn't help.
I have this, that works:
IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'Sam')
DROP TABLE Sam
Can I modify it to something like - -
IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME IN (Sam, Fred)
DROP TABLE Sam
DROP TABLE Fred
Results at the moment: Incorrect syntax near the keyword 'DROP'.
Thanks in advance for any help!
The world is full of good people.
I have this, that works:
IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'Sam')
DROP TABLE Sam
Can I modify it to something like - -
IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME IN (Sam, Fred)
DROP TABLE Sam
DROP TABLE Fred
Results at the moment: Incorrect syntax near the keyword 'DROP'.
Thanks in advance for any help!
The world is full of good people.