Announcement

Collapse
No announcement yet.

index automatisch befüllen lassen?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Also laut http://msdn.microsoft.com/de-de/library/ms188059.aspx

    geht das ja so:
    -- SET IDENTITY_INSERT to ON.
    SET IDENTITY_INSERT dbo.Tool ON
    GO

    -- Try to insert an explicit ID value of 3.
    INSERT INTO dbo.Tool (ID, Name) VALUES (3, 'Garden shovel')
    GO



    Was ich aber nicht ganz verstehe ist: wenn du wie unten beschrieben ein create table statement mit identity-spalte abgesetzt hast, warum stellst Du das identity-Insert nochmal explizit an?
    Wenn Du eine Tabelle erstellst

    CREATE TABLE dbo.Tmp_NewProduct
    (
    Prod_ProductID int NOT NULL IDENTITY (1, 1),
    Prod_CreatedBy int)

    und mit

    Insert into dbo.Tmp_NewProduct (Prod_CreatedBy)
    Select Prod_CreatedBy
    FROM dbo.NewProduct

    fügt er doch autamtisch die Datensätze mit einer neuen ID ein.

    Comment


    • #17
      Hi Stefanbo, hi ebis

      danke dass ihr euch Zeit für mein Problem nehmt. Ich werde sobald ich heute etwas Luft hab eure Vorschläge austesten und erstatte Bericht welche Befehle ich genau ausgeführt habe.

      Vielen Dank euch, ihr seid klasse!

      Comment

      Working...
      X