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 |
|
yipchunyu
Yak Posting Veteran
80 Posts |
Posted - 2005-07-20 : 13:20:27
|
| I have a table with field inputed with sth like "12:00 PM"when I cast it as datetime it display sth like "1899/1/1 12:00PM"However, when I just do sth like select Cast("12:00 PM" as datetime) it returns like "1900/1/1 12:00PM"Why it have a day diff?Any advice?thx |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2005-07-20 : 13:36:37
|
One of your words is new to me: "...display sth like..." and "...do sth like..."What does "sth" mean? quote: Originally posted by yipchunyu I have a table with field inputed with sth like "12:00 PM"when I cast it as datetime it display sth like "1899/1/1 12:00PM"However, when I just do sth like select Cast("12:00 PM" as datetime) it returns like "1900/1/1 12:00PM"Why it have a day diff?Any advice?thx
CODO ERGO SUM |
 |
|
|
yipchunyu
Yak Posting Veteran
80 Posts |
Posted - 2005-07-20 : 19:27:35
|
sth = something for me |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-07-21 : 01:39:55
|
What is the datatype of that field?It should display the default datedeclare @t table(d datetime)insert into @t values('12:00 PM')select cast(d as datetime) from @tSelect cast('12:00 PM' as datetime)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|