Professional Web Applications Themes

HELP! Needed with Fox Pro date math - ASP Database

I am accessing a Fox Pro database through ODBC in ASP. I have a table with two dates in it. A start date and an end date. I need to create a table with the difference between the two dates. Is the only way to load each record into an array and calculate the difference myself, or can it be done in the SELECT statement? --Dave...

  1. #1

    Default HELP! Needed with Fox Pro date math

    I am accessing a Fox Pro database through ODBC in ASP.

    I have a table with two dates in it. A start date and an end date. I
    need to create a table with the difference between the two dates.

    Is the only way to load each record into an array and calculate the
    difference myself, or can it be done in the SELECT statement?

    --Dave

    Dave Navarro Guest

  2. #2

    Default Re: HELP! Needed with Fox Pro date math

    Does FoxPro not have a DATEDIFF statement?

    INSERT INTO newTable(primary_key, Diff)
    SELECT primary_key, DATEDIFF(?, DateCol1, DateCol2)
    FROM oldTable

    I put ? in there for two reasons: (a) I don't know if FoxPro accepts string
    parameters or named constants, and (b) you didn't bother telling us what
    difference you want (hours, days, years, ...)



    "Dave Navarro" <davedave.dave> wrote in message
    news:MPG.199fce26bd82f77f989746news-east.giganews.com...
    > I am accessing a Fox Pro database through ODBC in ASP.
    >
    > I have a table with two dates in it. A start date and an end date. I
    > need to create a table with the difference between the two dates.
    >
    > Is the only way to load each record into an array and calculate the
    > difference myself, or can it be done in the SELECT statement?
    >
    > --Dave
    >

    Aaron Bertrand [MVP] Guest

  3. #3

    Default Re: HELP! Needed with Fox Pro date math

    In article <uR9Ayu0XDHA.1384TK2MSFTNGP10.phx.gbl>,
    [email]aaronTRASHaspfaq.com[/email] says...
    > Does FoxPro not have a DATEDIFF statement?
    >
    > INSERT INTO newTable(primary_key, Diff)
    > SELECT primary_key, DATEDIFF(?, DateCol1, DateCol2)
    > FROM oldTable
    >
    > I put ? in there for two reasons: (a) I don't know if FoxPro accepts string
    > parameters or named constants, and (b) you didn't bother telling us what
    > difference you want (hours, days, years, ...)
    Apparently Fox Pro does not.

    I need the number of days between two dates. It's a real estate
    application and I need to display a table showing the number of days
    between when a house was listed on the market and when it sold, sorted
    by the number of days it took to sell.

    The only way I can think of is to loop through the entire database and
    build and array. Very slow, but it works.

    --Dave
    Dave Navarro Guest

  4. #4

    Default Re: HELP! Needed with Fox Pro date math

    Dave Navarro wrote:
    > In article <uR9Ayu0XDHA.1384TK2MSFTNGP10.phx.gbl>,
    > [email]aaronTRASHaspfaq.com[/email] says...
    >> Does FoxPro not have a DATEDIFF statement?
    >>
    >> INSERT INTO newTable(primary_key, Diff)
    >> SELECT primary_key, DATEDIFF(?, DateCol1, DateCol2)
    >> FROM oldTable
    >>
    >> I put ? in there for two reasons: (a) I don't know if FoxPro accepts
    >> string parameters or named constants, and (b) you didn't bother
    >> telling us what difference you want (hours, days, years, ...)
    >
    > Apparently Fox Pro does not.
    >
    > I need the number of days between two dates. It's a real estate
    > application and I need to display a table showing the number of days
    > between when a house was listed on the market and when it sold, sorted
    > by the number of days it took to sell.
    >
    > The only way I can think of is to loop through the entire database and
    > build and array. Very slow, but it works.
    >
    > --Dave
    1. Don't loop through your "database". If you're going to create an array,
    use GetRows.
    2. You will have a better chance of discovering the FOXPRO syntax by asking
    on a FOXPRO newsgroup. Just because you're using ASP doesn't mean you HAVE
    to ask your question on an ASP newsgroup. Your question has to do with a
    FOXPRO query, which is totally separate from ASP (remember, you could just
    as well be running the query within the FOXPRO environment). Here's a likely
    candidate:
    microsoft.public.fox.vfp.queries-sql

    HTH,
    Bob Barrows


    Bob Barrows Guest

Similar Threads

  1. Math opreation with DATE
    By LEK0621 in forum Macromedia Flash Actionscript
    Replies: 1
    Last Post: March 3rd, 04:15 PM
  2. Replies: 4
    Last Post: December 19th, 07:09 AM
  3. Math Help Needed
    By Ralph Freshour in forum PHP Development
    Replies: 2
    Last Post: November 15th, 06:42 AM
  4. Date Math
    By bigforehand in forum Macromedia Dynamic HTML
    Replies: 1
    Last Post: August 19th, 05:14 PM
  5. Help needed with basic Perl math commands
    By \Dandy\ Randy in forum PERL Miscellaneous
    Replies: 4
    Last Post: July 27th, 05:11 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139