閱讀659 返回首頁    go 阿裏雲 go 技術社區[雲棲]


對於PowerDesigner中設計表自動生成Sql的分析

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

/*==============================================================*/
/* Table: DWLX                                                */
/*==============================================================*/
create table DWLX (
   DWLX_NM            varchar(36)          not null,
   DWLX_LXBH          varchar(6)           not null,
   DWLX_LXMC          varchar(64)          not null,
   DWLX_LEVEL         int                  not null,
   DWLX_FJNM          varchar(36)          not null,
   DWLX_MX            char(1)              not null,
   constraint PK_DWLX primary key nonclustered (DWLX_NM)
)
go

分析constraint PK_DWLX primary key nonclustered (DWLX_NM)這句話:

        對表DWLX建立主鍵約束,主鍵約束的名字是:PK_DWLX ,主鍵列是:DWLX_NM。

        PRIMARY KEY 約束默認為 CLUSTERED;UNIQUE 約束默認為 NONCLUSTERED。此處指明該表為nonclustered索引(即非聚集索引)。

小注:

        1、Sql Server判斷某個表是否存在:點擊打開鏈接

        2、SQL Server中clustered與nonclustered的區別 :點擊打開鏈接

        3、GO的意思是本語句塊結束的意思,一遇到GO就直接提交到存儲引擎。

              GO (Transact-SQL)官方文檔:點擊打開鏈接

最後更新:2017-04-03 16:49:17

  上一篇:go Oracle Least()函數
  下一篇:go android電話攔截