Irf*_*aza 4 sql-server stored-procedures
看看这个SP.
ALTER PROCEDURE [dbo].[sp_GetRecTitleVeh]
AS
BEGIN
select
a.StockNo, c.ClaimNo,
v.VIN, v.[Year],v.Make, v.Model,
c.DOAssign, t.DOLoss, t.RecTitleDate
From
dbo.Assignments a,
dbo.Assignment_ClaimInfo c,
dbo.Assignment_TitleInfo t,
dbo.Assignment_VehicleInfo v
Where
a.AssignmentID= c.AssignmentID and
c.AssignmentID= t.AssignmentID and
t.AssignmentID= v.AssignmentID and
t.RecTitleDate is not null and
c.InsuranceComp = 'XYZ' and
a.StockNo not in (select StockNo from dbo.Invoice where InvoiceType = 'Payment Invoice')
order by t.RecTitleDate
END
Run Code Online (Sandbox Code Playgroud)
此SP工作正常,并给我所需的结果.
我需要的是要问有没有最简单的方法来计算通过执行此SP获得的记录.对于前者 我是这样想的
select count(*) from sp_GetRecTitleVeh
Run Code Online (Sandbox Code Playgroud)
我知道有一个解决方案,如 -
ALTER PROCEDURE [dbo].[sp_CountRecTitleVeh]
AS
BEGIN
select
count(a.StockNo)
From
dbo.Assignments a,
dbo.Assignment_ClaimInfo c,
dbo.Assignment_TitleInfo t,
dbo.Assignment_VehicleInfo v
Where
a.AssignmentID= c.AssignmentID and
c.AssignmentID= t.AssignmentID and
t.AssignmentID= v.AssignmentID and
t.RecTitleDate is not null and
c.InsuranceComp = 'XYZ' and
a.StockNo not in (select StockNo from dbo.Invoice where InvoiceType = 'Payment Invoice')
order by t.RecTitleDate
END
Run Code Online (Sandbox Code Playgroud)
你知道我怎么能通过执行SP计算得到的记录.
感谢您分享宝贵的时间.