Results 1 to 2 of 2
  1. #1
    Join Date
    May 2008

    Unanswered: How to rewrite this stored procedure into a view ?

    Hi all

    i m trying to change the attached procedure into view.Can anyone help me for doing so?
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2002
    Reading, UK
    Not knowing the relationship between the tables makes it a bit hard. But a basic approach I often take as a starting point would be to put the three queries into 3 subqueries in the FROM clause. Then in the where clause put the join condition between the three subqueries i.e. the variables you use in the second and third queries which depend on the first query.

    As for the if..then else.. you can use a CASE statement to emulate this logic. The biggest problem is usually if the 2nd and 3rd queries return multiple rows for one row in the driving (first) query.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts