CREATE TABLE and CONSTRAINTS

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hirak1984
    Contributor
    • Jan 2007
    • 316

    #1

    CREATE TABLE and CONSTRAINTS

    well very new to sql,as I am...
    I am posting this query,please explain me what it is,

    Code:
      CREATE TABLE [dbo].[DOORD_ORDER] (
     [ORDER_NBR] [int] NOT NULL ,
     [TOTAL_SEQ_NBR] [int] NOT NULL ,
     [DELIVERY_IND] [char] (1) NOT NULL ,
     [CONTACT_LST_NME] [varchar] (30) NOT NULL ,
     [CONTACT_FRST_NME] [varchar] (40) NOT NULL ,
     [CONTACT_TYP] [varchar] (30) NOT NULL ,
     [CONTACT_TXT] [varchar] (100) NOT NULL ,
     [OR_CDE] [char] (1) NOT NULL ,
     [DROPOFF_DTE] [datetime] NOT NULL ,
     [PICKUP_DTE] [datetime] NOT NULL ,
     [LST_OPR_ID] [char] (8) NOT NULL ,
     [LST_MNT_TSMP] [datetime] NOT NULL ,
     [WAIT_INSTORE_IND] [char] (1) NOT NULL 
    ) ON [PRIMARY]
    GO
    ALTER TABLE [dbo].[DOORD_ORDER] WITH NOCHECK ADD 
     CONSTRAINT [PK_DOORD] PRIMARY KEY  CLUSTERED 
     (
      [ORDER_NBR]
     ) WITH  FILLFACTOR = 90  ON [PRIMARY] 
    GO
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Hirak

    This query creates a new table called [dbo].[DOORD_ORDER] and then adds a constraint to the table in this case designates the primary key [ORDER_NBR].

    Mary

    Comment

    • hirak1984
      Contributor
      • Jan 2007
      • 316

      #3
      well mary,is this oracle?

      we didnt do like this in oracle,right?
      please tell me what type of db query is this
      hirak
      Originally posted by mmccarthy
      Hirak

      This query creates a new table called [dbo].[DOORD_ORDER] and then adds a constraint to the table in this case designates the primary key [ORDER_NBR].

      Mary

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        Originally posted by hirak1984
        well mary,is this oracle?

        we didnt do like this in oracle,right?
        please tell me what type of db query is this
        hirak
        Actually it does look like Oracle to me. It's been a while since I've used it though so I could be wrong. It could also be SQL Server. Sorry Hirak I haven't used either in a few years and they all just blend together now.

        Mary

        Comment

        • hirak1984
          Contributor
          • Jan 2007
          • 316

          #5
          you need not be sorry mary because you are right.

          this is a sqlserver query I found out now.
          I am sorry to post it in oracle forum,because then I didnt have an idea,what it was.
          I dont have necessary privileges,plea se transfer it to the sqlserver forum
          Originally posted by mmccarthy
          Actually it does look like Oracle to me. It's been a while since I've used it though so I could be wrong. It could also be SQL Server. Sorry Hirak I haven't used either in a few years and they all just blend together now.

          Mary

          Comment

          Working...