Home > database >  SQL save date field values in the table into five figures such as: 41337, how to use the SQL functio
SQL save date field values in the table into five figures such as: 41337, how to use the SQL functio

Time:09-16

From excel bulk import data after the date into five figures, such as: 41337, I set the date fields in the table of the varchar type), how to use the SQL function batch conversion into a normal date format, such as: the 2020-4-20

CodePudding user response:

1 is in excel 1900-1-1, 2 is 1900-1-2, so use dateadd (day, n - 1, '1900-1-1') by the date

CodePudding user response:

Before the import into string format? CONVERT (VARCHAR (10), GETDATE (), 120)

CodePudding user response:

 
The select dateadd (hour, 8, dateadd (s, convert (int, '41337'), '1900-1-1'))
  • Related