Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
TAS
Yak Posting Veteran
65 Posts |
Posted - 2003-11-28 : 15:05:11
|
I use Convert(char(24),GetDate(),108) to insert time to table, but it always gives me something like '1900-01-01 14:59:19.000'(1900-01-01 in front of time).Does anybody tell why? |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-11-28 : 15:53:56
|
It doesn't. datetimes are stored as 2 binary fields. The first is the number of days since 1 jan 1900.For display the datetime is converted to a character value and if you display the date (0) you will see 1 jan 1900.You can format it to display just the time if you wish.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
SqlStar
Posting Yak Master
121 Posts |
Posted - 2003-11-29 : 03:25:59
|
If you want to store exact time value only, change your column datatype as "Varchar(8)" instead of "Datetime".":-) IT Knowledge is power :-)" |
|
|
nricardo
Starting Member
17 Posts |
Posted - 2003-12-01 : 13:45:38
|
but Varchar(8) won't function correctly if calculations are needed |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-12-01 : 13:48:07
|
nricardo, if you store the time portion in a datetime column, it will also add a date to it. To not see the date, use the CONVERT function when you SELECT the data.Tara |
|
|
Granick
Starting Member
46 Posts |
Posted - 2003-12-01 : 14:09:36
|
Anyone else notice that we have had a seemingly large number of date questions as of late? Shannon |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-12-01 : 14:15:48
|
Yukon might help these "user" problems as it will have a date data type and a time data type.Tara |
|
|
Granick
Starting Member
46 Posts |
Posted - 2003-12-01 : 17:14:26
|
Now the only issue would be, how long after Yukon comes out, will we finally get to switch to using it.Shannon |
|
|
|
|
|