Home Forums SQL Server 2005 T-SQL (SS2K5) Inserting value for identity column in a temporary table RE: Inserting value for identity column in a temporary table

  • Create Table #temp

    (RowID int identity(1,1) not null,

    MyID int not null,

    MyName varchar(50) not null

    )

    Insert into #temp (RowID, MyID, MyName)

    Select 1, 'Name'

    Should read Insert into #temp (MyID, MyName) as you have listed 3 fields to insert but only entered 2 fields, as you are using an identity field you need not enter a value for this.

    Facts are stubborn things, but statistics are more pliable - Mark Twain
    Carolyn
    SQLServerSpecialists[/url]