Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    311

    Unanswered: Simple Insert Err

    I am trying to do a simple insert 3 items into 3 colms the table has 4 the 4th is an identity with a seed of 1

    I am getting this error that i need an explicit val for the key


    TABLE SCRIPT :

    GO
    /****** Object: Table [dbo].[Company] Script Date: 03/30/2006 17:48:22 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Company](
    [idCompany] [int] IDENTITY(1,1) NOT NULL,
    [CompanyName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [Abreviation] [nchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [Sol] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    CONSTRAINT [PK_Company] PRIMARY KEY CLUSTERED
    (
    [idCompany] ASC
    )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]

    GO
    SET ANSI_PADDING OFF
    --SHOULDNT NEED THIS :
    --SET IDENTITY_INSERT dbo.Company ON



    INSERT INTO COMPANY
    VALUES('AmericanExpressCheck','Amex','ax')


    Msg 545, Level 16, State 1, Line 2
    Explicit value must be specified for identity column in table 'Company' either when IDENTITY_INSERT is set to ON or when a replication user is inserting into a NOT FOR REPLICATION identity column.

  2. #2
    Join Date
    Nov 2005
    Location
    San Francisco, CA
    Posts
    506
    Quote Originally Posted by mikezcg
    I am trying to do a simple insert 3 items into 3 colms the table has 4 the 4th is an identity with a seed of 1
    Strange I am not getting any error...
    Success is the ability to go from one failure to another with no loss of enthusiasm.
    - Sir Winston Churchill
    Joydeep

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •