create proc xx
as
create table #aa(a int)
insert #aa values(1)

解决方案 »

  1.   

    --请问在写存储过程时怎样创建临时表,怎样向临时表中添加数据?create proc p
    as
    create table #t(id int,b name)
    insert into #t values(1,'张三')
    go
      

  2.   

    例如:
    create proc test
    asselect * into #temp
    from sysobjectsselect * from #tempdrop table #tempgo
      

  3.   

    或:create proc test
    as
    select * into #新临时表 from 你的表select * from #新临时表
      

  4.   

    好像不用手动删除#temp吧,存储过程执行完#temp会自动删除