日期:2014-05-17  浏览次数:20400 次

sql存储过程
SQL code

ALTER procedure pro_InputExcel

@TableNameTrim varchar(100)    

AS

if not exists ('select * from sysobjects where  id = object_id('+@TableNameTrim+')  and type in (u) ' )
     'drop table ' + @TableNameTrim
BEGIN
    Declare @tableName As varchar(8000)
    set @tableName = '['+rtrim(@TableNameTrim)+']'
    EXEC(
    'Create Table'+ @tableName+' 
    (
    [id] int identity(1,1) not null primary key,
    Name varchar(8000) default 0
    )')
END





这段代码有错误请高手帮忙改改

------解决方案--------------------
请帖错误信息。
------解决方案--------------------
探讨

请帖错误信息。

------解决方案--------------------
错到家了。
= =
大哥
接字符串一定要用EXEC

if not exists ('select * from sysobjects where id = object_id('+@TableNameTrim+') and type in (u) ' )
'drop table ' + @TableNameTrim