Copying a row in the same table without having to type the 50+ column names (while changing 2 columns)

后端 未结 6 765
青春惊慌失措
青春惊慌失措 2021-01-31 09:35

During my job, I usually have to copy rows while changing their primary key and giving them a new stamp and maybe changing the foreign key.

The problem is I don\'t want

6条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-31 10:13

    You could make a simple stored procedure that take a table name and using the data dictionary writes the select statement text for you (the text of the select). Then copy, paste and Modify.

提交回复
热议问题