最新下载
热门教程
- 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 ,
相关文章
- 《彩色点点战争》推图常用三大主c玩法详解 01-23
- 《燕云十六声》池鱼林木任务攻略 01-23
- 《大连地铁e出行》查看行程记录方法 01-23
- 《明日方舟》2025春节限定干员余角色介绍 01-23
- 《崩坏:星穹铁道》万敌光锥搭配攻略 01-23
- 《燕云十六声》一药千金任务攻略 01-23