Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2005
    Posts
    9

    Unanswered: Retrieve Date using input parameters w/o GUI

    HI
    I want to retrieve data in between two date formats using a query in SQL?
    can i do it w/o using GUI tools?
    For Exp i have sales data from date 11/11/2000 to 11/2004.
    now as a user i want to give Input paramete value ranging between 06/06/2002 and 07/07/2002?
    Is there any SQL query which i can use to retrieve the above date values?
    Thanx in Advance
    VS

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    select foo, bar
      from salestable
     where salesdate between '2002-06-06' and '2002-07-07'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2005
    Posts
    9

    Retrieving data using input parametrs?

    I am sorry i could not understand what is foo bar>
    my ? was is there any chance of retieving data using a form or a dialog box. to accept input parameters to search in those fields.
    for example if i wish to search the data between 06/06/2004 and 07/07/2004 can a dialog box pops up and asks for begining date where i can enter 06/06/2004 and a second dialog box pops up and askd for ending date where i enter 07/07/2004. then the view or stored procedure or query should return all the data in that particular period?
    Thanx in advance
    vee yes

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    foo is the canonical example of a metasyntactic variable

    you will have to write some application code to generate those dialog boxes
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Is there a reason you posted this twice?

    http://www.dbforums.com/showthread.php?t=1118392

    There is no way to do what you want. Forms and dialog boxes are a function of the user interface, and MSSQL is purely a database server.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  6. #6
    Join Date
    Feb 2005
    Posts
    9
    Sorry i am new to this site, Made a mistake posting it twice. I apologise for it.

  7. #7
    Join Date
    Jan 2005
    Location
    TempDb
    Posts
    228
    Wow r937, thanks for the new word. Yeeeeee Haw! Since foo bar really does mean something, does that make it a multidimensional-metasyntactic-variable? Or does the space invalidate it?

    This is FreakingOutrageouslyOstentatious BeyondAllReality...
    I love deadlines. I like the whooshing sound they make as they fly by. Douglas Adams

  8. #8
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Quote Originally Posted by r937
    foo is the canonical example of a metasyntactic variable

    you will have to write some application code to generate those dialog boxes
    So, its like a doo-hicky or a thing-a-ma-bob?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  9. #9
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    yup

    or a widget, doodad, thingie, gizmo, gadget, dingus, gewgaw, knickknack, whatnot, bric-a-brac, folderol, jigger, gimmick, dingbat, thingamajig, thingum, contraption, whatchamacallit, or whatsis
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  10. #10
    Join Date
    Feb 2005
    Posts
    3

    Hello sri i am sorry to see all these ununderstandable replies

    There is no such facility in MSSQL Server to have that option of getting input dynamically at runtime.
    However you can make use of variables which can take the values from the existing tables of the database if at all they are available.

    Declare @startdate date,
    @enddate date
    go
    select @startdate=table.start_date, @enddate=table.end_date from table where sales_id = '111221'

    now you can use these values in your script.

    if you dont have any such table then create a table wth two fields
    start_date and end_date and every time update the date fields in the table so that your stored procedure takes the values from there

    you can update the date fields by simply opening the table in enterprise manager changing the values and executing agin freshly


    hope this helps

Posting Permissions

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