日期:2014-05-17 浏览次数:20321 次
CREATE PROC CreateNameTable
@name CLIENT_NAME
AS
DECLARE @result tinyint,@tableName NVARCHAR(50)
SET @tableName=N'[dbo].[' +@name+ N']'
EXEC @result=CheckForName @name
if(@result = 0)
RETURN 0
ELSE
BEGIN
IF(exists(SELECT * FROM dbo.sysobjects
WHERE id = OBJECT_ID(@tableName)
AND OBJECTPROPERTY(id,'IsUserTable')=1)
)
BEGIN
TRUNCATE TABLE @tableName
END
ELSE
BEGIN
CREATE TABLE @tableName
(
发送到 CLIENT_NAME ,
内容 NVARCHAR(500) NULL,
时间 datetime NOT NULL
)
END
RETURN 1
END
CREATE PROC CreateNameTable
@name CLIENT_NAME
AS
DECLARE @result tinyint,@tableName NVARCHAR(50)
SET @tableName=N'[dbo].[' +@name+ N']'
EXEC @result=CheckForName @name
if(@result = 0)
RETURN 0
ELSE
BEGIN
IF(exists(SELECT * FROM dbo.sysobjects
WHERE id = OBJECT_ID(@tableName)
AND OBJECTPROPERTY(id,'IsUserTable')=1)
)
BEGIN
EXEC('TRUNCATE table '+@tableName)
END
ELSE
BEGIN
EXEC('CREATE TABLE '+@tableName+'
(
发送到 CLIENT_NAME ,
内容 NVARCHAR(500) NULL,
时间 datetime NOT NULL
)')
END
RETURN 1
END
CREATE