How to generate database schema from enterprise manager?

  • Hi all,

    I tried to generate a schema from a database. It somehow seperate the create tables frrom the constraints in a table. The sample one is as follow:

     

    /****** Object:  Table [dbo].[CMRC_Customers]    Script Date: 1/6/2006 11:38:23 AM ******/

    CREATE TABLE [dbo].[CMRC_Customers] (

                [CustomerID] [int] IDENTITY (1, 1) NOT NULL ,

                [FullName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

                [EmailAddress] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

                [Password] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL

    ) ON [PRIMARY]

    GO

    Later on, it adds constraint in the generated script as follow:

    ALTER TABLE [dbo].[CMRC_Customers] ADD

                CONSTRAINT [PK_CMRC_Customers] PRIMARY KEY  NONCLUSTERED

                (

                            [CustomerID]

                )  ON [PRIMARY] ,

                CONSTRAINT [IX_Customers] UNIQUE  NONCLUSTERED

                (

                            [EmailAddress]

                )  ON [PRIMARY]

    GO

    /*********/

    What I am trying to ask is :is that possible to let it combined in one create table script? if yes, how to?

    Thank you.

    Betty

  • You'd have to code something to make that happen. Why do you need to have it in a single statement?

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply