Quickest way to clone row in SQL

前端 未结 5 1868
鱼传尺愫
鱼传尺愫 2020-12-19 14:44

I want to clone multiple tables\' rows that have a single primary key (PrimKey). What\'s the quickest way to clone a row in SQL Server 2005?

Here\'s an example,

5条回答
  •  忘掉有多难
    2020-12-19 15:05

    If you are cloning from multiple tables, the fastest way will be to use a stored procedure, so that all the queries stay on the database, and you don't pay a price for communication between the client and the server.

    Once you do that, then start unit-testing, to see how long it takes to do the operation. Then begin experimenting with changing it, based on suggestions you get, and see if you get any improvement.

提交回复
热议问题