Importing 2 digit years from Excel

  • Hi,

    I'm importing data from a client's spreadsheet and I want to transform their two digit year column into a four digit year in my SQL server 2000 table. Can anyone suggest the best way to do this? The main problem I'm having is with years such as 00 and 01 because the client has entered them as '00 and '01 which DTS transforms as NULL if you use a simple copy column transformation.

    Any help would be much appreciated.

    Simon.

  • Simon, normally the 2 digit year is "good enough". Internally SQL stores all dates as a number, not as a string. You can test this by creating a test table that has a column defined as date, then enter '8/31/01'. Then when you select the value back, you can control how it looks by using the convert function, specifically the style parameter.

    If you're row processing the import, just check for the value of '00' or '01, prepend '20' to it before continuing.

    Andy

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

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