使用表值函数进行通用查询

来源:互联网 发布:js的设计模式 编辑:程序博客网 时间:2024/05/18 14:44

 

create function dbo.edf
(
@job_id decimal(20))
returns @temptable table
(
fname 
varchar(20),
minit 
char(1),
lname 
varchar(30),
job_id 
smallint
)
as
begin
   
insert @temptable
   
select e.fname,e.minit,e.lname,e.job_id
   
from employee as e
   
where e.job_id>@job_id
   
return
end

select * from  edf(13