Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
GavinD1977
Yak Posting Veteran
83 Posts |
Posted - 2007-03-09 : 10:57:44
|
| Hi all.I am looking to write a script to create several new tables. What i would like to know is how do i check if they already exist before i create them and if they already exist dont create them? If they dont exist, create them.Cheers people. |
|
|
cas_o
Posting Yak Master
154 Posts |
Posted - 2007-03-09 : 11:00:43
|
| [CODE]if NOT exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[myTable]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)begincreate table myTable( id int identity(1,1) primary key)end[/CODE];-]... Quack Waddle |
 |
|
|
GavinD1977
Yak Posting Veteran
83 Posts |
Posted - 2007-03-09 : 11:20:16
|
| Great stuff mate.Thanks very much! |
 |
|
|
|
|
|