最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
在asp中如何创建动态表--调用如下sp_executesql
时间:2022-06-30 10:21:17 编辑:袖梨 来源:一聚教程网
/* -----------------------------------
产生论坛分类目录内容表过程
----------------------------------- */
CREATE PROCEDURE sp_createnew_bbscontent
@tabname varchar(200)='',
@boardid int
AS
declare @tri_inst_name nvarchar(100)
declare @tri_up_name nvarchar(100)
declare @tri_del_name nvarchar(100)
declare @deltab nvarchar(100)
declare @st nvarchar(2000)
select @tri_inst_name='inst_bbsContent'+LTRIM(RTRIM(str(@Boardid)))
select @tri_up_name='up_bbsContent'+LTRIM(RTRIM(str(@Boardid)))
select @tri_del_name='delete_bbsContent'+LTRIM(RTRIM(str(@Boardid)))
select @deltab='drop table '+@tabname
if len(@tabname)=0
return
if exists (select * from sysobjects where id = object_id(@tabname) and OBJECTPROPERTY(id, N'IsUserTable') = 1)
exec sp_executesql @deltab
select @st='CREATE TABLE '+@tabname+
'(
AnnounceID int identity (1, 1) NOT NULL ,
ParentID int default (0) NULL ,
Child int default (0) NULL ,
产生论坛分类目录内容表过程
----------------------------------- */
CREATE PROCEDURE sp_createnew_bbscontent
@tabname varchar(200)='',
@boardid int
AS
declare @tri_inst_name nvarchar(100)
declare @tri_up_name nvarchar(100)
declare @tri_del_name nvarchar(100)
declare @deltab nvarchar(100)
declare @st nvarchar(2000)
select @tri_inst_name='inst_bbsContent'+LTRIM(RTRIM(str(@Boardid)))
select @tri_up_name='up_bbsContent'+LTRIM(RTRIM(str(@Boardid)))
select @tri_del_name='delete_bbsContent'+LTRIM(RTRIM(str(@Boardid)))
select @deltab='drop table '+@tabname
if len(@tabname)=0
return
if exists (select * from sysobjects where id = object_id(@tabname) and OBJECTPROPERTY(id, N'IsUserTable') = 1)
exec sp_executesql @deltab
select @st='CREATE TABLE '+@tabname+
'(
AnnounceID int identity (1, 1) NOT NULL ,
ParentID int default (0) NULL ,
Child int default (0) NULL ,
相关文章
- 王者荣耀侦探能力大测试攻略 王者荣耀侦探能力大测试怎么过 11-22
- 无期迷途主线前瞻兑换码是什么 11-22
- 原神欧洛伦怎么培养 11-22
- 炉石传说网易云音乐联动怎么玩 11-22
- 永劫无间手游确幸转盘怎么样 11-22
- 无期迷途主线前瞻兑换码是什么 无期迷途主线前瞻直播兑换码介绍 11-22