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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Table Script

Author  Topic 

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-03-10 : 16:49:04
Could anyone help me how to generate Table Script like below
through T-SQL Statement

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[aaVersionControl]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[aaVersionControl]
GO

CREATE TABLE [dbo].[aaVersionControl] (
[Item] [char] (64) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL ,
[ItemType] [char] (10) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL
CONSTRAINT [IX_aaVersionControl] UNIQUE CLUSTERED
(
[Item],
[VersionNo],
[MinorVersionNo]
) WITH FILLFACTOR = 90 ON [PRIMARY]
) ON [PRIMARY]
GO




khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-03-10 : 17:39:18
why can't you use SQL Server Management Studio to do it ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-03-10 : 18:03:14
we are trying to call as a batch file

quote:
Originally posted by khtan

why can't you use SQL Server Management Studio to do it ?


KH
[spoiler]Time is always against us[/spoiler]



Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-03-10 : 19:51:18
you can also save the script as a file via the SSMS


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -