查询数据,插入临时表
代码
create procedure ProcName
@param1 param1Type,....
as
set nocount on
--和create table语句语法类似,列名 后接 列类型就够了,是你返回表的结构
declare @t table(id int,[name] varchar(20)....)
insert into @t (feild1,field2....)
select .....
from ....
where ...
group by ...
order by ....
set nocount off
select * from @t