在升級(jí)之前,建議先在查詢分析器中執(zhí)行 DBCC CHECKDB(年度庫名稱) 語句,檢查年度庫數(shù)據(jù)庫是否有一致性錯(cuò)誤,如果發(fā)現(xiàn)錯(cuò)誤,請(qǐng)按照SQL Server的提示進(jìn)行修復(fù),修復(fù)后再進(jìn)行升級(jí)。
數(shù)據(jù)庫名: UFDATA_002_2015
D:\U8SOFT\Admin\SQLFILE12500\Main\Ufdata\Structure\data_str_tm_mix_nl.sql
錯(cuò)誤信息:
-2147217900
無法從 'dbo.HR_TM_OverTimeVoucher.dAuditTime' 取消綁定。請(qǐng)使用 ALTER TABLE DROP CONSTRAINT。
執(zhí)行如下語句時(shí)出錯(cuò):
--假期額度
--hr_tm_Vacrate(假期額度)新增 nDoneVacAudited(已休(已審核請(qǐng)假),可為空,Number(7,2)
if not exists
(select *from syscolumns where id=OBJECT_ID('hr_tm_Vacrate') and name='nDoneVacAudited')
begin
alter table hr_tm_Vacrate add nDoneVacAudited [numeric](7,2) null
end
--hr_tm_Vacrate(假期額度)新增 nDoneVacAuditing 已休(審核中請(qǐng)假)可為空,Number(7,2)
if not exists
(select *from syscolumns where id=OBJECT_ID('hr_tm_Vacrate') and name='nDoneVacAuditing')
begin
alter table hr_tm_Vacrate add nDoneVacAuditing [numeric](7,2) null
end
--假期額度--
--月結(jié)果表--
--Hr_tm_MonthResult(月結(jié)果)新增 nCompTimeOffHoursAudited(調(diào)休(小時(shí))(已審核)),可為空,Number(7,2)
if not exists
(select *from syscolumns where id=OBJECT_ID('Hr_tm_MonthResult') and name='nCompTimeOffHoursAudited')
begin
alter table Hr_tm_MonthResult add nCompTimeOffHoursAudited [numeric](7,2) null
end
--Hr_tm_MonthResult(假期額度)新增 nCompTimeOffHoursAuditing 調(diào)休(小時(shí))(審核中) 可為空,Number(7,2)
if not exists
(select *from syscolumns where id=OBJECT_ID('Hr_tm_MonthResult') and name='nCompTimeOffHoursAuditing')
begin
alter table Hr_tm_MonthResult add nCompTimeOffHoursAuditing [numeric](7,2) null
end
--月結(jié)果表--
--加班單行抵扣子表--
--hr_tm_overtimeResultDeduct(加班單行抵扣子表)新增 nDeductOverTimeAuditing(抵扣加班時(shí)間(審核)),可為空,Number(6,2)
if not exists
(select *from syscolumns where id=OBJECT_ID('hr_tm_overtimeResultDeduct') and name='nDeductOverTimeAuditing')
begin
alter table hr_tm_overtimeResultDeduct add nDeductOverTimeAuditing [numeric](7,2) null
end
--hr_tm_overtimeResultDeduct(加班單行抵扣子表)新增 nDeductOverTimeAudited 抵扣加班時(shí)間(已審核) 可為空,Number(7,2)
if not exists
(select *from syscolumns where id=OBJECT_ID('hr_tm_overtimeResultDeduct') and name='nDeductOverTimeAudited')
begin
alter table hr_tm_overtimeResultDeduct add nDeductOverTimeAudited [numeric](7,2) null
end
--hr_tm_overtimeResultDeduct(加班單行抵扣子表)新增 nDealTimeAuditing 抵扣請(qǐng)假時(shí)間(審核中) 可為空,Number(7,2)
if not exists
(select *from syscolumns where id=OBJECT_ID('hr_tm_overtimeResultDeduct') and name='nDealTimeAuditing')
begin
alter table hr_tm_overtimeResultDeduct add nDealTimeAuditing [numeric](7,2) null
end
--hr_tm_overtimeResultDeduct(加班單行抵扣子表)新增 nDealTimeAudited 抵扣請(qǐng)假時(shí)間(已審核) 可為空,Number(7,2)
if not exists
(select *from syscolumns where id=OBJECT_ID('hr_tm_overtimeResultDeduct') and name='nDealTimeAudited')
begin
alter table hr_tm_overtimeResultDeduct add nDealTimeAudited [numeric](7,2) null
end
--加班單行抵扣子表--
--刪除列的默認(rèn)值
IF EXISTS ( SELECT name
FROM sysobjects
WHERE id = ( SELECT syscolumns.cdefault
FROM sysobjects
INNER JOIN syscolumns ON sysobjects.Id = syscolumns.Id
WHERE sysobjects.name = N'HR_TM_OverTimeVoucher'
AND syscolumns.name = N'dAuditTime'
) )
BEGIN
EXECUTE sp_unbindefault N'dbo.HR_TM_OverTimeVoucher.dAuditTime'
END
效率測(cè)試報(bào)告:開始升級(jí)UFDATA_002_2015數(shù)據(jù)庫
Data_STR_PB_mix_NL.SQL,2020-04-05 23:08:04 -- 2020-04-05 23:08:04,0小時(shí)0分鐘0秒。
Data_STR_PB_Vou_NL.SQL,2020-04-05 23:08:04 -- 2020-04-05 23:08:05,0小時(shí)0分鐘1秒。
DATA_STR_WF_MIX_NL.SQL,2020-04-05 23:08:05 -- 2020-04-05 23:08:05,0小時(shí)0分鐘0秒。
data_str_pb_wf_nl.SQL,2020-04-05 23:08:05 -- 2020-04-05 23:08:05,0小時(shí)0分鐘0秒。
data_str_ss_mix_nl.SQL,2020-04-05 23:08:05 -- 2020-04-05 23:08:05,0小時(shí)0分鐘0秒。
data_str_tm_mix_nl__up.SQL,2020-04-05 23:08:05 -- 2020-04-05 23:08:05,0小時(shí)0分鐘0秒。
升級(jí)起始時(shí)間:2020-04-05 23:08:04,結(jié)束時(shí)間:2020-04-05 23:08:05,0小時(shí)0分鐘1秒。