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

    Unanswered: Stored procedure

    Hello any one can help me in writing a stored procedure to accept input parametrs to search between two dates and retrieve data?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    wow, i admire your persistence, but really, if no one answered your previous question, then starting a new thread will probably not work

    what you're asking for is easy to find in any basic sql server course or textbook
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    "Computer, locate records between star date 14208 and 36767...quickly (<<<---table hint)"
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  4. #4
    Join Date
    Feb 2004
    Location
    San Antonio, TX
    Posts
    565
    are you hiding from me? it's not me is it?
    i just wanted to give you this code and then you ran off and created a new post.
    my psychiatrist says that i am getting a bit co-dependent and that i may be crowding you i hope not.
    i did re-write the code for you to allow for the between date parameters but just let me know if i am crowding you.

    just do me one favor... dont repost this one again cause you'll set my therapy back three years and to be honest i just became able to go outside without the football helmet.


    Code:
    /*
    this script creates a db, a table, and a stored procedure.
    the table shows the level of my malaise 
    which steadily grows from crappy to the ultimate level
    rdjabarov
    the proc asks for parameters representing a beginning date and a ending date  to return queried rows.
    */
    
    create database crappyDB
    go
    use Crappydb
    go 
    create table CrappyTable
    (
    col1 int
    ,col2 varchar(20)
    ,col3 datetime 
    ,col4 datetime
    )
    go
    
     insert into crappytable select 1, 'crappy', convert(varchar, getdate() , 110), convert(varchar, getdate() + 18, 110)
    union select 2, 'really crappy', convert(varchar, getdate() + 1, 110), convert(varchar, getdate() + 19, 110)
    union select 3, 'extra crappy', convert(varchar, getdate() + 2, 110), convert(varchar, getdate() + 20, 110)
    union select 4, 'totally crappy', convert(varchar, getdate() + 3, 110), convert(varchar, getdate() + 21, 110)
    union select 5, 'RDJabarov', convert(varchar, getdate() + 4, 110), convert(varchar, getdate() + 22, 110)
    go
    select * from crappytable
    go
    create  procedure Pcrappyproc
    @col3 datetime
    ,@col4 Datetime
    as 
    select col2 as 'rate my malaise' from crappytable 
    where col3 between  @col3 and @col4
    
    go
    exec Pcrappyproc '02-25-2005' , '3-25-2005'
     
    go
    --drop database crappydb

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    This second thread was actually started by vsripuram's evil twin.

    And by evil, I mean he is an Oracle developer...
    If it's not practically useful, then it's practically useless.

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

Posting Permissions

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