现在使用Erwin生成Sql 脚本时,生成的脚本没有判断表是否存在,不知道应该怎么进行设置。下面是Erwin生成的表结构:
CREATE TABLE "TherapeuticAreaMarket"
(
"MarketID" uniqueidentifier NOT NULL ,
"TherapeuticAreaID" uniqueidentifier NOT NULL ,
"CreatedOn" datetime NULL ,
"CreatedBy" uniqueidentifier NULL ,
"ModifiedOn" uniqueidentifier NULL ,
"ModifiedBy" uniqueidentifier NULL ,
"ID" uniqueidentifier NOT NULL ROWGUIDCOL
CONSTRAINT "DF_Source_Id_175276455"
DEFAULT newsequentialid(),
"Status" bit NULL
)
go
我想在生成结构之前加一居判断是否存在的语句,我期望的结果是:
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].TherapeuticAreaMarket') AND type in (N'U'))
DROP TABLE TherapeuticAreaMarket
CREATE TABLE "TherapeuticAreaMarket"
(
"MarketID" uniqueidentifier NOT NULL ,
"TherapeuticAreaID" uniqueidentifier NOT NULL ,
"CreatedOn" datetime NULL ,
"CreatedBy" uniqueidentifier NULL ,
"ModifiedOn" uniqueidentifier NULL ,
"ModifiedBy" uniqueidentifier NULL ,
"ID" uniqueidentifier NOT NULL ROWGUIDCOL
CONSTRAINT "DF_Source_Id_175276455"
DEFAULT newsequentialid(),
"Status" bit NULL
)
go
不知道应该如何设置。多谢了。
------解决方案--------------------------------------------------------
自己直接设置吧
------解决方案--------------------------------------------------------
看不懂
------解决方案--------------------------------------------------------
LZ真是高手
------解决方案--------------------------------------------------------
看不懂,继续顶