Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedure to a View 1

Status
Not open for further replies.

Mdavis123

Programmer
Nov 12, 2001
56
US
I have a sp that I would like to convert into a view. Any Ideas on this?

Thanks
MikeD
TP_ProcLU (
@AllCovered char(1),
@PayorPlankey int
)
AS
If @AllCovered is null OR upper(@AllCovered)='T' OR @PayorPlankey is null

Begin
select p.IntProcCode,p.CPTCode,p.Descr,p.Prockey
from bil_procedures p
order by p.intproccode
End
Else Begin
select p.IntProcCode,p.CPTCode,p.Descr,p.prockey
from bil_procedures p
left join BIL_CoveredProcs cp on
p.prockey=cp.prockey
where cp.payorplankey=@PayorPlankey
order by p.intproccode
End
 
You can't pass parameters int oa view nor have control of flow nor have an order by.

The view would have to produce the full resultset and the filtering would be done in the access of the view.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Thanks Nigelrivett for the input.

I saw another thread with some inline views and then did a little reading about paramerterized views.

I was trying to reduce the dependancies that shipped with a product.


Miked
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top