String to datetime

  • BULK INSERT [Temp]

       FROM '\\WLONS.CSV'

       WITH

          (

      FIRSTROW = 2,

             FIELDTERMINATOR = ',',

             ROWTERMINATOR = '\n'

          )

  • Paul,

    Well, I'm good and stumped here.  The only thing I can think of is that maybe there's a hidden newline character somewhere in the date field, but I'm not sure.

    Two things to try. 

    1) Change your character field to a varchar(12) and try the BULK INSERT without the ROWTERMINATOR.  See if that fixes the datetime issue.

    2) Do an OPENROWSET query to pull the Distinct values from your date field into SSMS and see if you can find the bad record that way.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

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

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