忧郁小孩 发表于 2009-4-20 10:59

END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE Proc .
@QueryStr nvarchar(300),--表名、视图名、查询语句
@PageSize int,--每页的大小(行数)
@PageCurrent int,--要显示的页
@FdShow nvarchar (300)='''',--要显示的字段列表,如果查询结果不需要标识字段,需要指定此值,且不包含标识字段
@FdOrder nvarchar (300)=''''--排序字段列表
as
set nocount on
declare @FdName nvarchar(250)--表中的主键或表、临时表中的标识列名
,@Id1 varchar(20),@Id2 varchar(20)--开始和结束的记录号
,@Obj_ID int--对象ID
--表中有复合主键的处理
declare @strfd nvarchar(2000)--复合主键列表
,@strjoin nvarchar(4000)--连接字段
,@strwhere nvarchar(2000)--查询条件


select @Obj_ID=object_id(@QueryStr)
,@FdShow=case isnull(@FdShow,'''') when '''' then '' *'' else '' ''+@FdShow end
,@FdOrder=case isnull(@FdOrder,'''') when '''' then '''' else '' order by ''+@FdOrder end
,@QueryStr=case when @Obj_ID is not null then '' ''+@QueryStr else '' (''+@QueryStr+'') a'' end

--如果显示第一页,可以直接用top来完成
if @PageCurrent=1
begin
select @Id1=cast(@PageSize as varchar(20))
exec(''select top ''+@Id1+@FdShow+'' from ''+@QueryStr+@FdOrder)
return
end

--如果是表,则检查表中是否有标识更或主键
if @Obj_ID is not null and objectproperty(@Obj_ID,''IsTable'')=1
begin
select @Id1=cast(@PageSize as varchar(20))
,@Id2=cast((@PageCurrent-1)*@PageSize as varchar(20))

select @FdName=name from syscolumns where id=@Obj_ID and status=0x80
if @@rowcount=0--如果表中无标识列,则检查表中是否有主键
begin
if not exists(select 1 from sysobjects where parent_obj=@Obj_ID and xtype=''PK'')
goto lbusetemp--如果表中无主键,则用临时表处理

select @FdName=name from syscolumns where id=@Obj_ID and colid in(
select colid from sysindexkeys where @Obj_ID=id and indid in(
select indid from sysindexes where @Obj_ID=id and name in(
select name from sysobjects where xtype=''PK'' and parent_obj=@Obj_ID
)))
if @@rowcount>1--检查表中的主键是否为复合主键
begin
select @strfd='''',@strjoin='''',@strwhere=''''
select @strfd=@strfd+'',[''+name+'']''
,@strjoin=@strjoin+'' and a.[''+name+'']=b.[''+name+'']''
,@strwhere=@strwhere+'' and b.[''+name+''] is null''
from syscolumns where id=@Obj_ID and colid in(
select colid from sysindexkeys where @Obj_ID=id and indid in(
select indid from sysindexes where @Obj_ID=id and name in(
select name from sysobjects where xtype=''PK'' and parent_obj=@Obj_ID
)))
select @strfd=substring(@strfd,2,2000)
,@strjoin=substring(@strjoin,5,4000)
,@strwhere=substring(@strwhere,5,4000)
goto lbusepk
end
end
end
else
goto lbusetemp

/*--使用标识列或主键为单一字段的处理方法--*/
lbuseidentity:
exec(''select top ''+@Id1+@FdShow+'' from ''+@QueryStr
+'' where ''+@FdName+'' not in(select top ''
+@Id2+'' ''+@FdName+'' from ''+@QueryStr+@FdOrder
+'')''+@FdOrder
)
return

/*--表中有复合主键的处理方法--*/
lbusepk:
exec(''select ''+@FdShow+'' from(select top ''+@Id1+'' a.* from
(select top 100 percent * from ''+@QueryStr+@FdOrder+'') a
left join (select top ''+@Id2+'' ''+@strfd+''
from ''+@QueryStr+@FdOrder+'') b on ''+@strjoin+''
where ''+@strwhere+'') a''
)
return

/*--用临时表处理的方法--*/
lbusetemp:
select @FdName=''''
,@Id1=cast(@PageSize*(@PageCurrent-1) as varchar(20))
,@Id2=cast(@PageSize*@PageCurrent-1 as varchar(20))

exec(''select ''+@FdName+''=identity(int,0,1),''+@FdShow+''
into #tb from''+@QueryStr+@FdOrder+''
select ''+@FdShow+'' from #tb where ''+@FdName+'' between ''
+@Id1+'' and ''+@Id2
)

'
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (20) NOT NULL,
        (20) NOT NULL,
        (200) NULL,
        (200) NULL,
        (50) NULL,
        (20) NULL,
        (20) NULL,
        (500) NULL,
        (50) NULL,
        (50) NULL,
        (4) NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        IDENTITY(1,1) NOT NULL,
        (20) NULL,
        (50) NULL,
        (50) NULL,
        (100) NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (18, 2) NULL,
        (18, 2) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        IDENTITY(1,1) NOT NULL,
        (50) NOT NULL,
        (20) NULL,
        (20) NULL,
        (20) NULL,
        (20) NULL,
        (50) NULL,
        (20) NULL,
        (20) NULL,
        (20) NULL,
        (20) NULL,
        (20) NULL,
        (20) NULL,
        (20) NULL,
        (20) NULL,
        (20) NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NOT NULL,
        (50) NOT NULL,
        NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NOT NULL,
        (50) NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (18, 0) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 2) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 2) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (18, 2) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 2) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 0) NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        NULL,
        NOT NULL,
        NOT NULL,
        (255) NULL,
        IDENTITY(1,1) NOT NULL,
        (50) NULL,
        (50) NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (12) NOT NULL,
        (50) NOT NULL,
        (50) NOT NULL,
        (50) NOT NULL,
        (20) NULL,
        (20) NULL,
        (50) NOT NULL,
        (50) NOT NULL,
        NOT NULL CONSTRAINT DEFAULT (0),
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        (50) NULL,
        (50) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        IDENTITY(1,1) NOT NULL,
        (50) NOT NULL,
        (50) NOT NULL,
        (50) NOT NULL,
        (200) NULL,
        (50) NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (20) NOT NULL,
        (20) NOT NULL,
        (50) NOT NULL,
        (30) NULL,
        NOT NULL CONSTRAINT DEFAULT (1),
        (200) NULL,
        (50) NULL,
        (50) NULL,
        (500) NULL,
        (200) NULL,
        IDENTITY(1,1) NOT NULL,
        (16) NULL,
        NOT NULL CONSTRAINT DEFAULT (18),
        (2) NOT NULL CONSTRAINT DEFAULT ('男'),
        (20) NULL,
        (30) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NOT NULL,
        (20) NOT NULL,
        (50) NOT NULL,
        (30) NOT NULL,
        (18, 2) NOT NULL CONSTRAINT DEFAULT (0),
        NOT NULL CONSTRAINT DEFAULT (0),
        IDENTITY(1,1) NOT NULL,
        (20) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NOT NULL,
        (50) NOT NULL,
        NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NOT NULL,
        (50) NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (18, 2) NOT NULL,
        (18, 3) NOT NULL,
        (18, 0) NOT NULL,
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 2) NOT NULL,
        (18, 0) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 2) NOT NULL,
        (18, 3) NOT NULL,
        (18, 2) NOT NULL,
        (18, 0) NOT NULL,
        (50) NULL,
        NULL,
        NOT NULL,
        NOT NULL,
        (255) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        IDENTITY(1,1) NOT NULL,
        (50) NOT NULL,
        (50) NOT NULL,
        (50) NULL,
        NULL,
        (50) NOT NULL,
        (50) NOT NULL,
        (50) NULL,
        (50) NULL,
        (18, 0) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        (50) NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NOT NULL,
        (50) NOT NULL,
        NOT NULL,
        (50) NULL,
        (50) NULL,
        NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (18, 2) NOT NULL,
        (50) NULL,
        (18, 3) NOT NULL,
        (18, 3) NOT NULL,
        (50) NULL,
        (18, 3) NOT NULL,
        (18, 0) NOT NULL,
        (50) NULL,
        (18, 3) NOT NULL,
        (18, 0) NOT NULL,
        (50) NULL,
        (50) NULL,
        (18, 2) NOT NULL,
        (18, 2) NOT NULL,
        (18, 2) NOT NULL,
        (18, 2) NOT NULL,
        (18, 1) NOT NULL,
        (18, 2) NOT NULL,
        (18, 2) NOT NULL,
        (18, 0) NOT NULL,
        (18, 2) NOT NULL,
        (18, 2) NOT NULL,
        (18, 1) NOT NULL,
        (18, 2) NOT NULL,
        NOT NULL,
        NOT NULL,
        NOT NULL,
        NOT NULL,
        NOT NULL,
        NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        NOT NULL,
        NULL,
        (50) NULL,
        (500) NULL,
        (500) NULL,
        (50) NULL,
        (50) NULL,
        (18, 0) NOT NULL,
        (18, 0) NOT NULL,
        (18, 2) NOT NULL,
        (18, 2) NOT NULL,
        (100) NULL,
        (100) NULL,
        (100) NULL,
        (100) NULL,
        (100) NULL,
        (100) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        NOT NULL,
        NOT NULL,
        NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        NULL,
        NULL,
        (50) NULL,
        (18, 0) NOT NULL,
        (18, 2) NOT NULL,
        (50) NULL,
        (18, 2) NOT NULL,
        (18, 3) NOT NULL,
        (50) NULL,
        (18, 3) NOT NULL,
        (18, 0) NOT NULL,
        (50) NULL,
        (18, 3) NOT NULL,
        (18, 0) NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (500) NULL,
        (500) NULL,
        (50) NULL,
        NOT NULL CONSTRAINT DEFAULT (1),
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (100) NULL,
        (200) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        NOT NULL,
        (50) NULL,
        (50) NULL,
        (18, 1) NOT NULL,
        (18, 0) NOT NULL,
        (200) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (18, 0) NOT NULL,
        (18, 3) NOT NULL,
        NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (18, 3) NOT NULL,
        (200) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        IDENTITY(1,1) NOT NULL,
        (20) NOT NULL,
        NOT NULL CONSTRAINT DEFAULT (0),
        (25) NOT NULL,
        (25) NOT NULL,
        (20) NULL,
        (20) NULL,
        (20) NOT NULL,
        NOT NULL CONSTRAINT DEFAULT (1),
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        NOT NULL CONSTRAINT DEFAULT (0),
        NOT NULL CONSTRAINT DEFAULT (0),
        (18, 2) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 1) NOT NULL CONSTRAINT DEFAULT (0),
        (70) NULL,
        (200) NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (18, 0) NOT NULL,
        (18, 3) NOT NULL,
        (200) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        (50) NULL,
        (100) NULL,
        (200) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (18, 0) NOT NULL,
        (18, 3) NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (18, 3) NOT NULL,
        (200) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NOT NULL,
        (50) NOT NULL,
        NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NOT NULL,
        (50) NOT NULL,
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 2) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 2) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        (18, 2) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 2) NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        NULL,
        NOT NULL,
        NOT NULL,
        (300) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        NULL,
        NULL,
        (50) NULL,
        (18, 0) NOT NULL CONSTRAINT DEFAULT (1),
        (18, 2) NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        (18, 2) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 0) NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        (18, 3) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 0) NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (500) NULL,
        (50) NULL,
        NOT NULL CONSTRAINT DEFAULT (0),
        NOT NULL CONSTRAINT DEFAULT (0),
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        IDENTITY(1,1) NOT NULL,
        (20) NOT NULL,
        (25) NOT NULL,
        (25) NOT NULL,
        (20) NOT NULL,
        (20) NULL,
        (20) NULL,
        (20) NULL,
        NOT NULL,
        NOT NULL,
        NOT NULL,
        (70) NULL,
        (70) NULL,
        (18, 2) NOT NULL,
        (200) NULL,
CONSTRAINT PRIMARY KEY CLUSTERED
(
        ASC
) ON
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (18, 0) NOT NULL,
        (18, 3) NOT NULL,
        (200) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NOT NULL,
        (50) NOT NULL,
        NOT NULL,
        (50) NOT NULL,
        (50) NOT NULL,
        (50) NOT NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (18, 3) NULL,
        (18, 0) NULL,
        (18, 3) NULL,
        (18, 0) NULL,
        (18, 2) NULL,
        (18, 2) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (18, 3) NULL,
        (18, 0) NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (50) NULL,
        NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        (50) NULL,
        (100) NULL,
        (200) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'.') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE .(
        (50) NULL,
        (50) NULL,
        (50) NULL,
        NOT NULL CONSTRAINT DEFAULT (0),
        (50) NULL,
        (50) NULL,
        (18, 1) NOT NULL CONSTRAINT DEFAULT (0),
        (18, 0) NOT NULL CONSTRAINT DEFAULT (0),
        (200) NULL,
        IDENTITY(1,1) NOT NULL
) ON
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

半支香烟 发表于 2009-5-10 12:36

好靓的樱花!

闲佬一只 发表于 2010-10-12 21:49

火滚.
页: 1 [2]
查看完整版本: 樱花!好美的樱花!