Create | dynamic/*-----------------------------------
Generate Forum Catalog Content table process
----------------------------------- */
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,
user_id int NULL,
Boardid int NULL,
Topic nvarchar (255) NULL,
Body ntext NULL,
DateAndTime datetime Default (GETDATE ()) NULL,
Hits int Default (0) NULL,
Length int Default (0) NULL,
Rootid int Default (0) NULL,
Layer tinyint default (1) NULL,
Orders int Default (0) NULL,
Ip nvarchar (+) default (0) NULL,
Expression nvarchar (m) NULL,
Forbid tinyint default (0) NULL
)'
&nbs