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.
51 lines
1.8 KiB
51 lines
1.8 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_SYS_AttachmentFiles
|
|
(
|
|
OrganizationID varchar(50) NOT NULL,
|
|
TargetRelationID varchar(36) NOT NULL,
|
|
SourceRelationID varchar(36) NOT NULL,
|
|
FileName nvarchar(200) NOT NULL,
|
|
SubFileName nvarchar(100) NOT NULL,
|
|
FilePath nvarchar(500) NULL,
|
|
FileSize int NULL,
|
|
FileContent image NULL,
|
|
FileType nvarchar(50) NULL,
|
|
FileDescription nvarchar(500) NULL,
|
|
Memo nvarchar(MAX) 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_SYS_AttachmentFiles SET (LOCK_ESCALATION = TABLE)
|
|
GO
|
|
IF EXISTS(SELECT * FROM dbo.OTB_SYS_AttachmentFiles)
|
|
EXEC('INSERT INTO dbo.Tmp_OTB_SYS_AttachmentFiles (TargetRelationID, SourceRelationID, FileName, SubFileName, FilePath, FileSize, FileContent, FileType, FileDescription, Memo, CreateUser, CreateDate, ModifyUser, ModifyDate)
|
|
SELECT TargetRelationID, SourceRelationID, FileName, SubFileName, FilePath, FileSize, FileContent, FileType, FileDescription, Memo, CreateUser, CreateDate, ModifyUser, ModifyDate FROM dbo.OTB_SYS_AttachmentFiles WITH (HOLDLOCK TABLOCKX)')
|
|
GO
|
|
DROP TABLE dbo.OTB_SYS_AttachmentFiles
|
|
GO
|
|
EXECUTE sp_rename N'dbo.Tmp_OTB_SYS_AttachmentFiles', N'OTB_SYS_AttachmentFiles', 'OBJECT'
|
|
GO
|
|
ALTER TABLE dbo.OTB_SYS_AttachmentFiles ADD CONSTRAINT
|
|
PK_TB_SYS_AttachmentFiles PRIMARY KEY CLUSTERED
|
|
(
|
|
OrganizationID,
|
|
TargetRelationID
|
|
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
|
|
GO
|
|
COMMIT
|