Date in SQL: 1/1/1900

  • Thread starter Aaron [SQL Server MVP]
  • Start date
A

Aaron [SQL Server MVP]

(a) You need delimiters around your dates (6/9/2004 is a very small number,
and this will be interpreted as a time only, so the date becomes the
default, 1900-01-01).

(b) Quit using ambiguous, regional date formats! For SQL Server, always
pass YYYYMMDD. This is the only safe format that is guaranteed not to
change June 9th to September 6th, somewhere down the stream.
 
R

Roji. P. Thomas

It should be

"Insert into CustSalesRecTrns(
User_ID,customer,trnsdate,item,qty,SysRecordDate) Values
(0,30,'6/9/2004',1456,234,234,0,0,'6/9/2004')"
 
I

Ice Man

Greetings

I'm building an insert SQL statement then doing a response.write then
executing it
the Response.write is giving me something like the following:

"Insert into CustSalesRecTrns(
User_ID,customer,trnsdate,item,qty,SysRecordDate) Values
(0,30,6/9/2004,1456,234,234,0,0,6/9/2004)"

but when I go to browse the table in SQL Server Entrprise Manager it gives
me in the trnsdate and sysrecorddate the value: 1/1/1900

Could sombody help me?

Regards,
 
I

Ice Man

Thanks a lot Guys it worked! :)


Roji. P. Thomas said:
It should be

"Insert into CustSalesRecTrns(
User_ID,customer,trnsdate,item,qty,SysRecordDate) Values
(0,30,'6/9/2004',1456,234,234,0,0,'6/9/2004')"
 
I

Ice Man

Dear Aaron

My system clock is correct actually it's part of a network of more than 250
PCs that gets synchronized with a server at startup! Now while writing these
lines the time on my PC is 9:23 AM (I'm in Beirut/ Middle East)
the time Zone is Cairo +2 GMT but maybe it's the "daylight saving changes"
that is doing this to my PC
usually in winter we are +2 GMT but in summer we change our clock so it
become +3 GMT

So Aaron, what u think? is there something that I must to fix in my computer
settings so the newsgroup server can understand we are +3 GMT now?

Regards,
Elie Constantine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top