How do you copy a record in a SQL table but swap out the unique id of the new row?

前端 未结 11 565
猫巷女王i
猫巷女王i 2020-11-30 19:09

This question comes close to what I need, but my scenario is slightly different. The source table and destination table are the same and the primary key is a uniqueidentifie

11条回答
  •  旧时难觅i
    2020-11-30 19:41

    I'm guessing you're trying to avoid writing out all the column names. If you're using SQL Management Studio you can easily right click on the table and Script As Insert.. then you can mess around with that output to create your query.

提交回复
热议问题