Professional Web Applications Themes

dates in a column - Microsoft SQL / MS SQL Server

  you just need to get the first_date value, then join to the table again to get the next_date value and use datediff ( dd, first_date , next_date ). You could also use a cursor to get the prev row value? Regards, Phil...

  1. #1

    Default dates in a column

     

    you just need to get the first_date value, then join to
    the table again to get the next_date value and use
    datediff ( dd, first_date , next_date ).

    You could also use a cursor to get the prev row value?

    Regards,
    Phil
    phil Guest

  2. #2

    Default RE: dates in a column

    Hi,

    As Aaron mentioned, you may post your table structure (DDLs), and detailed
    requirement, so that we can perform further research.


    Bill Cheng
    Microsoft Online Partner Support

    Get Secure! - www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.
    --------------------
    | Content-Class: urn:content-classes:message
    | From: "jhood" <com>
    | Sender: "jhood" <com>
    | Subject: dates in a column
    | Date: Sun, 13 Jul 2003 17:30:58 -0700
    | Lines: 5
    | Message-ID: <05b801c3499f$31c81610$gbl>
    | MIME-Version: 1.0
    | Content-Type: text/plain;
    | cht="iso-8859-1"
    | Content-Transfer-Encoding: 7bit
    | X-Newsreader: Microsoft CDO for Windows 2000
    | Thread-Index: AcNJnzHIzO/zumz0Rkqq4KtX0JBzEw==
    | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    | Newsgroups: microsoft.public.sqlserver.programming
    | Path: cpmsftngxa06.phx.gbl
    | Xref: cpmsftngxa06.phx.gbl microsoft.public.sqlserver.programming:373203
    | NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
    | X-Tomcat-NG: microsoft.public.sqlserver.programming
    |
    | If I have a column with various dates in order, how could
    | I create another table with a column with the differences
    | between those dates?
    |
    | Thank you.
    |

    Bill Guest

  3. #3

    Default Re: dates in a column

    All depends on what you need in the other table.

    For instnce if you just want to have the differences along with the related
    PK value you might actually do a view instead and use

    DATEDIFF((differenceinquestion),date1, date2)

    (See SQL BOL)

    If you want the table to have other data then use DATEDIFF to calculate the
    value for population.

    "jhood" <com> wrote in message
    news:05b801c3499f$31c81610$gbl... 


    James Guest

Similar Threads

  1. Converting a 3 column pdf address list to a one column MS word doc
    By Jay_Jump@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 0
    Last Post: February 9th, 06:46 PM
  2. Column chart need column to exceed axis maximum value
    By zanedev in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: May 8th, 04:26 PM
  3. Bound Column or Template Column (w dAdapater?) in DataGrid
    By Ravichandran Mahalingam in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: January 9th, 03:30 PM
  4. Convert an MS Access Yes/No column to a checkbox column in C# datagrid
    By Gregory Rampton in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: August 6th, 04:09 PM
  5. Replies: 0
    Last Post: July 7th, 08:32 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