English 中文(简体)
服务器一栏至另一栏的数据散页
原标题:Bulk copy of data from one column to another in SQL Server
  • 时间:2010-09-20 18:10:00
  •  标签:
  • sql-server

我想将一个栏的数值复制到服务器的另一栏。 这项行动需要贯穿whole DB,200M。 我要问的是:

UPDATE [Net].[dbo].[LINK]
SET  [LINK_ERRORS] = [OLD_LINK_ERRORS]

然而,很快就会发生。 我用尽了交易记录和查询。 在战 the中采取这种做法的最佳方式是什么?

感谢

问题回答

更新200兆瓦的浏览量不是一个好的想法。

或者,你可以把所有数据选入新的表格,并抄录联接系统。 ERRORS field in the SlectT,

select *, OLD_LINK_ERRORS as LINK_ERRORS into LINK_tmp from LINK
GO
exec sp_rename LINK, LINK_bkp
GO
exec sp_rename LINK_tmp, LINK
GO
drop table LINK_bkp

或者,如果你将做的下一个事情在最初的OLD_LINK_ERRORS一栏中消失,你可以做这样的事情:

sp_rename  LINK.OLD_LINK_ERRORS ,  LINK_ERRORS ,  COLUMN 
GO
ALTER TABLE LINK ADD OLD_LINK_ERRORS <data type>
GO

多种更新可能发挥作用。

update dbo.LINK
set LINK_ERRORS=OLD_LINK_ERRORS
where ID between 1 and 1000000

update dbo.LINK
set LINK_ERRORS=OLD_LINK_ERRORS
where ID between 1000001 and 2000000

......

我将考虑在信息社会首脑会议中这样做,因为在那里,你可以轻易控制批量(交易)的规模,并利用信息社会首脑会议提供的大量行动。 当然,如果你需要方案解决办法,这或许不会奏效。 这将是一个非常三边的信息社会首脑会议行动。





相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

SQL server: Can NT accounts be mapped to SQL server accounts

In our database we have an SQL server account that has the correct roles to access some of the databases. We are now switching to windows authentication and I was wondering if we can create a NT user ...

SQL Server 2000, ADO 2.8, VB6

How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8

热门标签