dbTalk Databases Forums  

Which data type for time interval?

microsoft.public.sqlserver.setup microsoft.public.sqlserver.setup


Discuss Which data type for time interval? in the microsoft.public.sqlserver.setup forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tim Burkart
 
Posts: n/a

Default Which data type for time interval? - 04-26-2007 , 01:51 PM






What is the best data type for time intervals? I have a CSV file that
I want to import using DTS. col4 in the data sample below represents
time intervals (hh:mm:ss.milliseconds) I am free to define the table
in any way. Thus far I have tried varchar for all columns, varchar for
col1, col2, datetime for col3, col4. DTS imports the varchar and
calendar date data fine however adds a calendar date and AM/PM to the
time interval. If I define col4 as (var)char data then Crystal Reports
does not allow me to process it arithmetically (i.e. sum, average,
etc.).

HWA,,4/20/2007,01:30.30
HWA,,4/21/2007,0.17
HWA,,4/22/2007,0.18
HWA,,4/23/2007,01:32.00
HWA,,4/24/2007,01:44.60
HWA,,4/25/2007,12.28
HWB,,4/24/2007,4.60
HWC,,4/20/2007,55.55
HWC,,4/23/2007,01:22.30

regards,

tim


Reply With Quote
  #2  
Old   
David Portas
 
Posts: n/a

Default Re: Which data type for time interval? - 04-27-2007 , 01:15 AM






"Tim Burkart" <burkartt (AT) dhw (DOT) idaho.gov> wrote

Quote:
What is the best data type for time intervals?
An interval is just time elapsed: N milliseconds (or some other unit). So
naturally I would use an integer or numeric type.

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/m...S,SQL.90).aspx
--




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.