db2 exists的使用
/*==============================================================*//* Database name: 国债兑付业务管理系统 *//* DBMS name: Sybase AS Enterprise 11.x *//*
·
/*==============================================================*/
/* Database name: 国债兑付业务管理系统 */
/* DBMS name: Sybase AS Enterprise 11.x */
/* Created on: 2005-1-4 9:12:06 */
/*==============================================================*/
if exists (select 1
from sysindexes
from sysindexes
where id = object_id('htd_bgzdfhz')
and name = 'QueryByBj'
and indid > 0
and indid < 255)
drop index htd_bgzdfhz.QueryByBj
go
if exists (select 1
from sysobjects
where id = object_id('htd_bgzdfhz')
and type = 'U')
drop table htd_bgzdfhz
go
if exists(select 1 from systypes where name='bs')
execute sp_droptype bs
go
/*==============================================================*/
/* Table: htd_bgzdfhz */
/*==============================================================*/
create table htd_bgzdfhz (
gkdm nchar(10) not null,
ssgkdm nchar(10) not null,
sbgkdm nchar(10) not null,
yhdm nvarchar(12) not null,
zwnd nchar(8) not null,
bjdm nvarchar(22) not null,
bjnlj numeric(18,2) null,
lxdm nvarchar(22) not null,
lxnlj numeric(18,2) null,
pdxz nchar(2) null,
xsbz nchar(1) not null,
constraint PK_HTD_BGZDFHZ primary key (bjdm, yhdm, gkdm, lxdm, zwnd, sbgkdm, xsbz, ssgkdm)
)
go
/*==============================================================*/
/* Index: QueryByBj */
/*==============================================================*/
create index QueryByBj on htd_bgzdfhz (
bjdm,
yhdm,
gkdm,
zwnd
)
go
/* Database name: 国债兑付业务管理系统 */
/* DBMS name: Sybase AS Enterprise 11.x */
/* Created on: 2005-1-4 9:12:06 */
/*==============================================================*/
if exists (select 1
from sysindexes
from sysindexes
where id = object_id('htd_bgzdfhz')
and name = 'QueryByBj'
and indid > 0
and indid < 255)
drop index htd_bgzdfhz.QueryByBj
go
if exists (select 1
from sysobjects
where id = object_id('htd_bgzdfhz')
and type = 'U')
drop table htd_bgzdfhz
go
if exists(select 1 from systypes where name='bs')
execute sp_droptype bs
go
/*==============================================================*/
/* Table: htd_bgzdfhz */
/*==============================================================*/
create table htd_bgzdfhz (
gkdm nchar(10) not null,
ssgkdm nchar(10) not null,
sbgkdm nchar(10) not null,
yhdm nvarchar(12) not null,
zwnd nchar(8) not null,
bjdm nvarchar(22) not null,
bjnlj numeric(18,2) null,
lxdm nvarchar(22) not null,
lxnlj numeric(18,2) null,
pdxz nchar(2) null,
xsbz nchar(1) not null,
constraint PK_HTD_BGZDFHZ primary key (bjdm, yhdm, gkdm, lxdm, zwnd, sbgkdm, xsbz, ssgkdm)
)
go
/*==============================================================*/
/* Index: QueryByBj */
/*==============================================================*/
create index QueryByBj on htd_bgzdfhz (
bjdm,
yhdm,
gkdm,
zwnd
)
go
更多推荐
已为社区贡献1条内容
所有评论(0)