Skip to main content
December 16, 2021
Question

how to import excel datetime column into database

  • December 16, 2021
  • 2 replies
  • 0 views

as title, my excel column logintime previously let it transimit to be text(String) into database successfully.

However, if i want it directly insert into datetime format always fail, the example shows in excel as "2019/11/28  8:08:27"

    2 replies

    March 26, 2022

    Is it fine in Excel template ? please update the excel formate use formate cell and formate whole column as you want. it shold provide a stable format. 

    christineh465186
    April 1, 2022

    another idea is to load the excel into a staging table of sorts with the columns being strings. Then run a stored proc to loop through and move the data. when doing that you can format / cast the string to datetime since it is in a known format. Just a thought if you continue to encounter struggles or are afraid people will remove the format on the column in the excel.