You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

60 lines
2.3 KiB

/* 為了避免任何可能發生資料遺失的問題,您應該先詳細檢視此指令碼,然後才能在資料庫設計工具環境以外的位置執行。*/
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
GO
CREATE TABLE dbo.Tmp_OTB_PRJ_ProjectInfo
(
ProjectNumber varchar(50) NOT NULL,
CustomerID varchar(50) NOT NULL,
ProjectEName nvarchar(200) NOT NULL,
ProjectCName nvarchar(200) NOT NULL,
ProjectManager varchar(50) NOT NULL,
ProjectClass varchar(200) NOT NULL,
ProgramLanguage varchar(200) NOT NULL,
ProgramVersion varchar(10) NULL,
[Database] varchar(200) NOT NULL,
DatabaseVersion varchar(10) NULL,
PStartDate datetime NULL,
PDeadLine datetime NULL,
ActualStartDate datetime NULL,
ActualDeadLine datetime NULL,
ProjectStatus varchar(5) NULL,
PrjAvgProgress int NULL,
PrjWorkCount int NULL,
PrjMinWorkTimeID varchar(50) NOT NULL,
PrjMaxWorkTimeID varchar(50) NOT NULL,
Notice nvarchar(2000) NULL,
Memo text NULL,
CreateUser varchar(50) NULL,
CreateDate datetime NULL,
ModifyUser varchar(50) NULL,
ModifyDate datetime NULL
) ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE dbo.Tmp_OTB_PRJ_ProjectInfo SET (LOCK_ESCALATION = TABLE)
GO
IF EXISTS(SELECT * FROM dbo.OTB_PRJ_ProjectInfo)
EXEC('INSERT INTO dbo.Tmp_OTB_PRJ_ProjectInfo (ProjectNumber, CustomerID, ProjectEName, ProjectCName, ProjectManager, ProjectClass, ProgramLanguage, ProgramVersion, [Database], DatabaseVersion, PStartDate, PDeadLine, ActualStartDate, ActualDeadLine, ProjectStatus, Notice, Memo, CreateUser, CreateDate, ModifyUser, ModifyDate)
SELECT ProjectNumber, CustomerID, ProjectEName, ProjectCName, ProjectManager, ProjectClass, ProgramLanguage, ProgramVersion, [Database], DatabaseVersion, PStartDate, PDeadLine, ActualStartDate, ActualDeadLine, ProjectStatus, Notice, Memo, CreateUser, CreateDate, ModifyUser, ModifyDate FROM dbo.OTB_PRJ_ProjectInfo WITH (HOLDLOCK TABLOCKX)')
GO
DROP TABLE dbo.OTB_PRJ_ProjectInfo
GO
EXECUTE sp_rename N'dbo.Tmp_OTB_PRJ_ProjectInfo', N'OTB_PRJ_ProjectInfo', 'OBJECT'
GO
ALTER TABLE dbo.OTB_PRJ_ProjectInfo ADD CONSTRAINT
PK_OTB_PRJ_ProjectInfo PRIMARY KEY CLUSTERED
(
ProjectNumber
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
COMMIT