本文介绍了为两个查询编写一个存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hai friendz,
我写了两个sp
一个是用于通过EmployeeId选择AdminId
另一个是用于通过AdminId选择公司名称
another one is for Selecting CompanyName by AdminId
select E.CompanyId,C.CompanyName from Employee E,Company C where E.AdminId =@AdminId and E.CompanyId=C.Id
我想在我传递EmployeeId的地方通过AdminId选择CompanyName.因此我为此写了两个sp.s..
有什么办法可以将这两个sp.s组合起来吗?
我想将这两个写在一个单独的...
请帮帮我
在此先感谢
i want to select CompanyName by AdminId where I am passing EmployeeId..so i written two sp''s for that..
Is there any way to combine these two sp''s..
I want to write these two in a single sp...
Please help me
Thanks in advance
推荐答案
SELECT e.AdminId , s.CompanyName,s.CompanyId
FROM Employee e
INNER JOIN Company s
ON e.AdminId = s.AdminId
WHERE e.EmployeeId=@EmpId
IF condition
(statement)
Else 'if insert returns an error'
( statement)
end
这篇关于为两个查询编写一个存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!