1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[SQL] Create a mapping between inserted row and the temp table id [duplicate]

Discussão em 'Outras Linguagens' iniciado por Stack, Abril 10, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using SQL Server

    Temp table:

    CREATE TABLE #temp(
    id INT PRIMARY KEY,
    n NVARCHAR(MAX),
    d NVARCHAR(MAX),
    eUrl NVARCHAR(MAX),
    tp NVARCHAR(MAX),
    cIdINT
    );


    Insert command:

    INSERT INTO table (n, d, created, cId)
    OUTPUT eti.id, INSERTED.id, INSERTED.n
    INTO @InsertedIds (sourceId, targetId, n)
    SELECT eti.n, eti.d, @curTime, eti.cId
    FROM #temp AS eti


    I'm getting:


    The multi-part identifier "eti.id" could not be bound

    Tried a few modification with table name, alias name, source.id, src.id but nothing worked here.

    Continue reading...

Compartilhe esta Página