table datatype Problem

  • DECLARE

    @table TABLE (primary_key INT IDENTITY(1,1) NOT NULL, Itm_ID INT, Itm_Desc varchar(1000))

    INSERT

    INTO @table VALUES(1,'123')

    INSERT INTO @table VALUES(2,'abc')

    delete

    @table

    --DBCC CHECKIDENT (@table)

    select

    * from @table

    can any one help me

    i was trying to reset the identity column but  it genetares error

    ??????????????????????????????????

    how to solve???????????????????

     

  • I don't think you can reseed table variables.

    CREATE

    table #table (primary_key INT IDENTITY(1,1) NOT NULL, Itm_ID INT, Itm_Desc varchar(1000))

    INSERT

    INTO #table VALUES(1,'123')

    INSERT

    INTO #table VALUES(2,'abc')

    delete

    #table

    DBCC

    CHECKIDENT (#table, reseed, 0)

    INSERT

    INTO #table VALUES(99,'peso')

    select

    * from #table

    drop

    table #table

     


    N 56°04'39.16"
    E 12°55'05.25"

  • Table variable is just a variable - not a table. You can't use DBCC , you can't use TRUNCATE TABLE... just SELECT, INSERT, UPDATE, DELETE. I know of no way to reseed identity column in a table variable.

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

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