----为表增加默认值
ALTER TABLE [dbo].[ksd_form_chk] ADD CONSTRAINT [DF_ksd_form_chk_Ftp_Time] DEFAULT (getdate()) FOR [Ftp_Time]
GO
ALTER TABLE [dbo].[ksd_form_chk] ADD CONSTRAINT [DF_ksd_form_chk_msrepl_tran_version] DEFAULT (newid()) FOR [msrepl_tran_version]
GO
----设置列为主键
alter table [dbo].[ksd_form_chk] alter constraint PK_ksd_form_chk primary key (ksdid)
----删除列信息
alter table [dbo].[ksd_form_chk] drop column ksdid
----设置列为自动增长列
alter table [dbo].[ksd_form_chk] add ksdid int Identity(1,1) not null
--同台服务器,不同库,相同表结构之间迁移数据
insert into KSD1_X64_2012A_Q3.dbo.ksd_check([ENTRY_ID],[DECL_DATE],[TRADE_CODE],[DECL_CODE],[FIT_DATE],[I_E_FLAG],[RSLT_FLAG_CODE],[RSLT_DATE]
,[FLAG],[ENTRY_ID18],[chk_local] )
select [ENTRY_ID],[DECL_DATE],[TRADE_CODE],[DECL_CODE],[FIT_DATE],[I_E_FLAG],[RSLT_FLAG_CODE],[RSLT_DATE]
,[FLAG],[ENTRY_ID18],[chk_local] from KSD1_X64_2012A_Q2.dbo. ksd_check where CONVERT(int,RSLT_DATE)>012063023 order by CONVERT(int,RSLT_DATE)
|