|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I have data look like follows to tell the Date + Time
2008-03-20T04:30:00Z Does SQLServer has a datatype to store directly from the above format (Date + Time) ============== Any datatype to store duration like (1 hour 30 min) 01H30M |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
<worlman385@yahoo.com> wrote in message
news:q6ceu3p1a457b2kpsqct36nbprlpmd05j8@4ax.com... >I have data look like follows to tell the Date + Time > > 2008-03-20T04:30:00Z > > Does SQLServer has a datatype to store directly from the above format > (Date + Time) > > ============== > > Any datatype to store duration like (1 hour 30 min) > > 01H30M Dates and times don't have any format in SQL Server. They are just values. However, if you have a *string* in the form '2008-03-20T04:30:00Z' you can convert it to a DATETIME value like this: SELECT CAST('2008-03-20T04:30:00Z' AS DATETIME); You cannot store any time zone component with a DATETIME in SQL Server 2005. You can in 2008 using the DATETIMEOFFSET type. Duration is just a scalar value in some base units (such as seconds or minutes). Use a numeric type for durations. -- David Portas |
|
![]() |
| Outils de la discussion | |
|
|