Roddy Balkan
Roddy Balkan

Reputation: 1639

Should I store Employee StartDate as DT_Date, DT_DBDate or DateTime2

I have a new Employee Tracking app that I am building. I am importing the employee data from an Excel Spreadsheet using SSIS into MSSQL 2016 Database. Should I transform and save the employee StartDate info as a 'DT_Date', 'DT_DBDate' or 'DateTime2'?

It seems to me that I should save it as a DT_DBDate type since the time of day at which a person joined is never relevant in my app. I am concerned however, that I might be limiting myself in being able to do things in the future such as datetime arithmetic and have been unable to find anywhere articles on when to use the different date types. I'm hoping to get any suggestions on what type I should choose and why.

Upvotes: 1

Views: 663

Answers (1)

VKarthik
VKarthik

Reputation: 1429

From my experience of dealing with Excel source data, when it comes to datetime/date fields treat them as strings and use derived column transformations to modify the data into the data type that you need. You may get into strange issues. If your end column is date then DT_DBDATE or if your end column is a datetime, DT_DBDATETIME.

Upvotes: 1

Related Questions