September 8, 2007 at 10:54 am
Hi friends,
create table Sep_92
(
Regno int,
Payment datetime
)
insert into Sep_92 values (19,2005/12/05)
select * from Sep_92
i am getting this output
1900-01-01 00:00:00.00019
1900-01-01 00:00:00.00019
1900-01-01 00:00:00.00019
1900-02-03 00:00:00.000
perfect date is not getting what i can do any body plz help me
September 8, 2007 at 11:01 am
Always mention the column names when inserting. In case someone decises the names have to be alfabetically sorted.
insert into Sep_92 (Regno,Payment) values (19,'2005/12/05')
September 8, 2007 at 11:14 am
try this instead: ...values (19,'2005/12/05') (note the single-quotes around the date)
Without quotes, SQL Server sees 2005/12/05 as 2005 ÷ 12 ÷ 5, which rounds to the integer value 33. Your insert statement actually was this:
insert into Sep_92 values (19,33)
For date values, Day 0 = Jan 1, 1900, so day 33 = Feb 3, 1900.
-Eddie
Eddie Wuerch
MCM: SQL
September 8, 2007 at 7:02 pm
As a bit of a sidebar... why is it necessary to create a table named after a month and year???
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply