Link to home
Start Free TrialLog in
Avatar of jazz__man
jazz__man

asked on

Can someone please simplify this merge sql server statement for me please

Can someone please explain this in lay mans terms to me please

MERGE T s
USING (
        SELECT TID, name, address
        FROM T [s]
      ) d on 0 = 1
WHEN NOT MATCHED
THEN INSERT (name, address)
    VALUES (name, address)
OUTPUT d.TID as oID, Inserted.TID as nID
INTO @t;
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

All the rows (name and address fields only) from table T are re-inserted into the same table (because of "on 0 = 1")
ASKER CERTIFIED SOLUTION
Avatar of Shaun Kline
Shaun Kline
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial