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 |
|
magmo
Aged Yak Warrior
558 Posts |
Posted - 2007-10-03 : 03:29:25
|
| HiI have a smalldatetime field and try to insert a date using this code...INSERT INTO tbl_P_Comments (DateMade, PID, AID)VALUES(28/9/2007,35,32)But when I do that the date inserted is 1900-01-01 00:00:00Why is that? Am I doing something wrong...Regards |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-10-03 : 03:51:42
|
what you are specifying is 28 divide by 9 divide by 2007 = 0INSERT INTO tbl_P_Comments (DateMade, PID, AID)VALUES ('20070928',35,32) KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-10-03 : 04:14:47
|
| 1 date values should be expressed within single quotes2 better to use YYYYMMDD HH:MM:SS format as suggestedMadhivananFailing to plan is Planning to fail |
 |
|
|
magmo
Aged Yak Warrior
558 Posts |
Posted - 2007-10-03 : 04:31:10
|
| HiAllrighty, got it working now, Thanks!Regards |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-10-03 : 04:38:32
|
quote: Originally posted by magmo HiAllrighty, got it working now, Thanks!Regards
Also make sure you use proper DATETIME datatype to store datesMadhivananFailing to plan is Planning to fail |
 |
|
|
magmo
Aged Yak Warrior
558 Posts |
Posted - 2007-10-03 : 05:30:40
|
| I use smalldatetime |
 |
|
|
|
|
|
|
|