Possible Duplicate:
SQL Server: Check if table exists
CREATE TABLE IF NOT EXISTS works on MySQL but fails with SQL Server 2008 R2. What is the equivalent syntax?
The below code will create a table called vehicle if the table does not already exist.
if not exists (select * from sysobjects where name='vehicle' and xtype='U') create table vehicle ( Name varchar(64) not null )go
if not exists (select * from sysobjects where name='vehicle' and xtype='U')
create table vehicle (
Name varchar(64) not null
)
go