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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-05-01 : 08:54:41
|
| chris writes "HelloI am attempting to insert a date into a datetime field on an sql server. When I insert a date such as '5/5/2002' into the table, Sql Server chops off some of the information, leaving the date in this format: '5/5/02'. I am sure that it is not my application server that is altering my dates because I have hardcoded some dates for debugging and received the same results. I appreciate your feedback. I couldn't find a solution to this anywhere.Cheers" |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-05-01 : 09:01:15
|
| This is not a storage issue, it is a display issue. SQL Server actually stores the datetime data internally as two 4-byte integers. The first 4 bytes store the number of days before or after jan 1, 1900. The other 4 bytes store the time of day represented as the number of milliseconds after midnight. So if you tell it 2002, it stores 2002 . . .Look of CAST, CONVERT and SET DATEFORMAT in Books On Line to resolve your display issues.<O> |
 |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2002-05-01 : 09:02:31
|
| The 'chopping off' as you call it is done in the presentation layer (i.e. the query analyser, VB app, Access etc). You need to have a look at this before looking at the back-end.Tim |
 |
|
|
|
|
|