Excel Number to SQL Date

  • Hello

    How can I transfer any excel number (e.g. 40346) to sql-date (e.g. 17.06.2010)?

    Thanks for your helps

    Chaepp

  • The following in theory should work.

    Find out the 0 date in Excel, for this example let's assume it's the same 0 date as the datetime data type 1/1/1900.

    If the Excel number was 40,000 you would perform the follwing to get the same date in SQL:

    SELECT DATEADD(dd,40000,'1 jan 1900')

    Obviously you will need to offset the base date to whatever it is in Excel.

    Rich

    Hope this helps,
    Rich

    [p]
    [/p]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply