declare @table_guid nvarchar(50)
select @table_guid=newid()
set @table_guid='#AA'+@table_guid
print @table_guid
CREATE TABLE @table_guid(x INT PRIMARY KEY)
select * from #t
drop table @table_guid

解决方案 »

  1.   

    print @table_guid
    上面的都没有错
      

  2.   

    CREATE TABLE @table_guid--》declare
      

  3.   

    declare @table_guid nvarchar(50)而且这里 下面不能再做表名了
      

  4.   

    declare @table_guid nvarchar(50)
    select @table_guid=newid()
    set @table_guid='#AA'+@table_guid
    print @table_guid
    exec('create table ['+@table_guid+'](x INT PRIMARY KEY)')