When doing a script Table why are some columns a normal name, type not null and some are after the Primary ans alter table add col

  • CREATE TABLE [dba].[OPENREC](
        [Store] [char](4) NOT NULL,
        [STate] [varchar](4) NULL,
        [Type] [varchar](30) NULL,
        [unitnum] [varchar](20) NULL
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    SET ANSI_PADDING OFF
    ALTER TABLE [dba].[OPENREC] ADD [OERNUMBER] [varchar](50) NULL
    SET ANSI_PADDING ON
    ALTER TABLE [dba].[OPENREC] ADD [JobTypeDescription] [varchar](16) NULL
    ALTER TABLE [dba].[OPENREC] ADD [JobTypeCode] [char](2) NULL
    ALTER TABLE [dba].[OPENREC] ADD [JobStatus] [char](1) NULL
    ALTER TABLE [dba].[OPENREC] ADD [ActionCode] [varchar](50) NULL

    .....................................

  • lee.hopkins - Thursday, February 21, 2019 9:56 AM

    CREATE TABLE [dba].[OPENREC](
        [Store] [char](4) NOT NULL,
        [STate] [varchar](4) NULL,
        [Type] [varchar](30) NULL,
        [unitnum] [varchar](20) NULL
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    SET ANSI_PADDING OFF
    ALTER TABLE [dba].[OPENREC] ADD [OERNUMBER] [varchar](50) NULL
    SET ANSI_PADDING ON
    ALTER TABLE [dba].[OPENREC] ADD [JobTypeDescription] [varchar](16) NULL
    ALTER TABLE [dba].[OPENREC] ADD [JobTypeCode] [char](2) NULL
    ALTER TABLE [dba].[OPENREC] ADD [JobStatus] [char](1) NULL
    ALTER TABLE [dba].[OPENREC] ADD [ActionCode] [varchar](50) NULL

    .....................................

    Most likely the columns have different ansi padding settings. You can check different column properties, settings by querying sys.columns for your table, something like:
    SELECT object_name(object_id) as TableName, *
    FROM sys.columns
    WHERE object_id = object_id('OPENREC')

    Sue

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

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