XSLT存档  

不及格的程序员-八神

 查看分类:  ASP.NET XML/XSLT JavaScripT   我的MSN空间Blog

解决PowerDesigner 16 Generate Datebase For Sql2005/2008 对象名sysproperties无效的问题

在PowerDesigner 16 中生成的sql语句,在执行的时候报错:对象名sysproperties 无效的错误;造成此问题的原因是由于Sql 2005、2008 删除了系统表 sysproperties 而改用 sys.extended_properties 表所致 

很明显这些都是产生设计注释的,可以忽略掉, 

 设置PowerDesinger生成选项,将Comment字段去掉

 之后生成的SQL语句 就不包含那些有错的代码了,不需要修改改什么模板代码 乱七八槽的了。

if exists (select 1
   from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
   where r.fkeyid = object_id('tCollectionHistory') and o.name = 'FK_tCollectionHistory_REFERENCE_tControlNodes')
alter table tCollectionHistory
   drop constraint FK_tCollectionHistory_REFERENCE_tControlNodes
go

if exists (select 1
   from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
   where r.fkeyid = object_id('tCollectionLog') and o.name = 'FK_tCollectionLog_REFERENCE_tControlNodes')
alter table tCollectionLog
   drop constraint FK_tCollectionLog_REFERENCE_tControlNodes
go

if exists (select 1
   from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
   where r.fkeyid = object_id('tControlNodes') and o.name = 'FK_TCONTROL_REFERENCE_TWORKSHO')
alter table tControlNodes
   drop constraint FK_TCONTROL_REFERENCE_TWORKSHO
go

if exists (select 1
   from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
   where r.fkeyid = object_id('tControlNodesCurrentValue') and o.name = 'FK_tControlNodesCurrentValue_REFERENCE_tControlNodes')
alter table tControlNodesCurrentValue
   drop constraint FK_tControlNodesCurrentValue_REFERENCE_tControlNodes
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('tCollectionHistory')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index tCollectionHistory.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('tCollectionHistory')
            and   type = 'U')
   drop table tCollectionHistory
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('tCollectionLog')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index tCollectionLog.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('tCollectionLog')
            and   type = 'U')
   drop table tCollectionLog
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('tControlNodes')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index tControlNodes.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('tControlNodes')
            and   type = 'U')
   drop table tControlNodes
go

if exists (select 1
            from  sysobjects
           where  id = object_id('tControlNodesCurrentValue')
            and   type = 'U')
   drop table tControlNodesCurrentValue
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('tWorkShop')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index tWorkShop.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('tWorkShop')
            and   type = 'U')
   drop table tWorkShop
go

/*==============================================================*/
/* Table: tCollectionHistory                                    */
/*==============================================================*/
create table tCollectionHistory (
   iID_tControlNodes    uniqueidentifier     not null,
   cNodeNmae            nvarchar(50)         not null,
   cValue               nvarchar(50)         not null,
   dCreate              datetime             not null default getDate(),
   constraint PK_TCOLLECTIONHISTORY primary key (iID_tControlNodes)
)
go

/*==============================================================*/
/* Index: Index_1                                               */
/*==============================================================*/
create unique index Index_1 on tCollectionHistory (
cNodeNmae ASC,
iID_tControlNodes ASC
)
go

/*==============================================================*/
/* Table: tCollectionLog                                        */
/*==============================================================*/
create table tCollectionLog (
   iID_tControlNodes    uniqueidentifier     not null,
   cNodeName            nvarchar(50)         null,
   cValue               nvarchar(50)         null,
   iType                smallint             null,
   dCreate              datetime             not null default getdate(),
   cReturnInfo          nvarchar(4000)       null,
   constraint PK_TCOLLECTIONLOG primary key (iID_tControlNodes)
)
go

/*==============================================================*/
/* Index: Index_1                                               */
/*==============================================================*/
create unique index Index_1 on tCollectionLog (
iID_tControlNodes ASC,
cNodeName ASC
)
go

/*==============================================================*/
/* Table: tControlNodes                                         */
/*==============================================================*/
create table tControlNodes (
   iID_tWorkShop        uniqueidentifier     not null,
   iID                  uniqueidentifier     RowGuidCol not null constraint NodeRowID default 'NEWSEQUENTIALID()',
   cNodeName            nvarchar(50)         not null,
   cDescription         nvarchar(200)        null,
   cMeasureUp           nvarchar(20)         null,
   cMeasureDown         nvarchar(20)         null,
   cUnit                nvarchar(10)         null,
   cDisplayFormat       nvarchar(10)         null,
   bDisabled            bit                  not null default 0,
   dCreate              datetime             not null default getdate(),
   constraint PK_TCONTROLNODES primary key (iID)
)
go

/*==============================================================*/
/* Index: Index_1                                               */
/*==============================================================*/
create unique index Index_1 on tControlNodes (
iID_tWorkShop ASC,
cNodeName ASC
)
go

/*==============================================================*/
/* Table: tControlNodesCurrentValue                             */
/*==============================================================*/
create table tControlNodesCurrentValue (
   iID_tControlNodes    uniqueidentifier     not null,
   cValue               nvarchar(50)         not null,
   dInvoke              datetime             not null default getDate(),
   constraint PK_TCONTROLNODESCURRENTVALUE primary key (iID_tControlNodes)
)
go

/*==============================================================*/
/* Table: tWorkShop                                             */
/*==============================================================*/
create table tWorkShop (
   iID                  uniqueidentifier     RowGuidCol not null constraint workShopID default 'NEWSEQUENTIALID()',
   cName                nvarchar(50)         not null,
   cMemo                nvarchar(200)        null,
   dCreate              datetime             not null default getdate(),
   constraint PK_TWORKSHOP primary key (iID)
)
go

/*==============================================================*/
/* Index: Index_1                                               */
/*==============================================================*/
create unique index Index_1 on tWorkShop (
cName ASC
)
go

alter table tCollectionHistory
   add constraint FK_tCollectionHistory_REFERENCE_tControlNodes foreign key (iID_tControlNodes)
      references tControlNodes (iID)
go

alter table tCollectionLog
   add constraint FK_tCollectionLog_REFERENCE_tControlNodes foreign key (iID_tControlNodes)
      references tControlNodes (iID)
go

alter table tControlNodes
   add constraint FK_TCONTROL_REFERENCE_TWORKSHO foreign key (iID_tWorkShop)
      references tWorkShop (iID)
go

alter table tControlNodesCurrentValue
   add constraint FK_tControlNodesCurrentValue_REFERENCE_tControlNodes foreign key (iID_tControlNodes)
      references tControlNodes (iID)
go

 

posted on 2023-10-11 16:37  不及格的程序员-八神  阅读(50)  评论(0编辑  收藏  举报