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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to input parameters into views that a another view is based on?

Status
Not open for further replies.

handlebars

Technical User
Feb 18, 2003
270
GB
I am having problems working out how to write a stored procedure to take the parameters for three underlying views that make up another view.

It is for a report that has calculated views that are based on date parameters.

Can anyone point me in the right direction???

Any help would be appreciated

Andrew
 
Ok you might not like me for this one...
First..
Nesting Views is often not only problmeatic, but can cause all sorts of hidden performance problmes.
SEcond..
Have you thought about using UserDefinedFunctions (UDF's)
They have the ability to return "table" type results and take input parameters. (The behave very much like Oracles Paramitized Views). One of the really cool things here is that you can join them in a query and treat them exaclty like a table.
Third..
ah heck there is no third.. :)

 
Tell us more about what you want to do. I'm guessing that you don't need a view or a UDF.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Agree, nesting views is an extremely poor idea. You will do three times or more the amount of work the database needs to do to get the repsonse. ANd more than likely you will be selecting all kinds of unneded data in the process.

Views do not accept parameters. Write a stored procedure.

Questions about posting. See faq183-874
 
Thanks for your replies,

I still cannot understand how I can get this to work without using nesting of some sort.

I have three views which all need have the same input (date) parameters. These views are a count of total number of support requests and a breakdown of the various types of SLAs
This the same for the requests logged and resolved (so two more views for each)

I wanted to tie these all up with another view that can be used to generate a management report (that is grouped by IS teams).

I have got it working ok with nested veiws but was only not sure how to pass the input the parameters to the underlying views.

If what you are saying is that you should never nest a view like this, i am curious how I could achieve the same results using a UDF.

All help is fully appreciated.

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top