Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Posts
    16

    Unanswered: Parameters in a VIEW

    How do you go about creating a parameter in a view? In Access SQL, I know it is done like this:

    parameter @monthSelect as int;
    SELECT tbl_xlat_beg.HCNumber, tbl_xlat_beg.LocationID, tbl_xlat_beg.BegValue, tbl_xlat_beg.Unit, tblbeg.use_id,
    tbl_xlat_beg.Month_id
    FROM tbl_xlat_beg
    WHERE (((tbl_xlat_beg.Month) = [@monthSelect]))

    where monthSelect is requested. I'm trying to set up a group of queries to gather info but am not sure how to do this or for that matter test this in SQL. Any ideas would be great.

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Views cannot directly accept parameters. You may be able to achieve the same functionality with a user-defined function or a stored procedure, both of which are also more efficient than views.

    blindman

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    That's what the predicate is for...

    I know in Access you can reference a control that doesn't exists

    SELECT * FROM myTable WHERE myDate = [Please Enter a Date]

    And you get a dialog...

    You could just as easily have a control on a form the predicate references..
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

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