sql command to create table if not exists code example
Example 1: create table if not exists sql
CREATE TABLE IF NOT EXISTS
> CREATE TABLE IF NOT EXISTS TEAMS
> (TEAMNO INTEGER NOT NULL PRIMARY KEY,
> EmployeeNO INTEGER NOT NULL,
> DIVISION CHAR(6) NOT NULL);
Example 2: sql server check table exists
IF EXISTS
(SELECT object_id FROM sys.tables
WHERE name = 'Artists'
AND SCHEMA_NAME(schema_id) = 'dbo')
PRINT 'The table exists'
ELSE
PRINT 'The table does not exist';