怎么样在存储过程中声明一个临时表,然后在从另一张表中查询数据后依次插入新表中

来源:百度知道 编辑:UC知道 时间:2024/05/17 00:07:32

用全局临时表

create procedure P
as
if object_id('Tempdb..##') is not null
drop table ##
create table ##(ID int)
go
exec p
insert ## select 1

select * from ##

像你这样,不需要先声明,再使用,直接可以用,比如:

select * into #tmp from tb

这是完全可以的,非常正常的

有问题hi我

不可以