if not exists (select * from sysobjects where name="cars" and xtype="U")
create table cars (
Name varchar(64) not null
)
go
The above will create a table called cars
if the table does not already exist.
More Related Contents:
- Calculating distance between two points (Latitude, Longitude)
- How to rewrite IS DISTINCT FROM and IS NOT DISTINCT FROM in SQL Server 20008R2?
- T-SQL split string based on delimiter
- WHERE Clause vs ON when using JOIN
- Partition Function COUNT() OVER possible using DISTINCT
- Cannot use UPDATE with OUTPUT clause when a trigger is on the table
- CASE WHEN statement for ORDER BY clause
- How to get last 7 days data from current datetime to last 7 days in sql server
- Script to kill all connections to a database (More than RESTRICTED_USER ROLLBACK)
- Reference an alias elsewhere in the SELECT list
- Using IF ELSE statement based on Count to execute different Insert statements
- How to find out what is locking my tables?
- Passing dynamic order by in stored procedure
- Select SQL Server database size
- Check if table exists and if it doesn’t exist, create it in SQL Server 2008
- How do I find the data directory for a SQL Server instance?
- How to return default value from SQL query
- How to concatenate all columns in a select with SQL Server
- How to automatically generate unique id in SQL like UID12345678?
- How to update two tables in one statement in SQL Server 2005?
- Foreign Key to non-primary key
- Dynamic SQL – EXEC(@SQL) versus EXEC SP_EXECUTESQL(@SQL)
- Get all dates between two dates in SQL Server
- Solution for: Store update, insert, or delete statement affected an unexpected number of rows (0) [closed]
- SQL grouping by month and year
- “IN” clause limitation in Sql Server
- Meaning of square brackets [] in MS-SQL table designer? [duplicate]
- Count Returning blank instead of 0
- Backup a single table with its data from a database in sql server 2008
- When to use EXCEPT as opposed to NOT EXISTS in Transact SQL?