Aimal Khan
Aimal Khan

Reputation: 1019

Facing issues regarding using datetime/time/varchar datatypes in sql server

I'm currently working on an Employee leave management system where I need to handle time duration of above 24 hours in sql server and i could not find any solution but to use varchar datatype instead of time/datetime datatype because time/datetime data types has thier limitations.

BUT on the other hand, i also require that particular varchar data type column to be used as datetime in order to generate reports so EVENTUALLY my question is that

Is there any alternative to this situation? Using varchar as time/datetime? A little help would really be appreciated. Thank you

Upvotes: 0

Views: 63

Answers (1)

Visual Studio Guy
Visual Studio Guy

Reputation: 144

I'd rather use BIGINT data type if I REALLY NEED to save TimeSpan or duration in the database. It may either be the total number in seconds or ticks, then do the conversion somewhere else (use something like DATEADD function in SQL Server or TimeSpan in C#).

Upvotes: 1

Related Questions