Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 01:43 PM
Ice Man
Guest
 
Posts: n/a
Default Date in SQL: 1/1/1900

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,


  #2  
Old July 19th, 2005, 01:43 PM
Roji. P. Thomas
Guest
 
Posts: n/a
Default Re: Date in SQL: 1/1/1900

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')"


--
Roji. P. Thomas
SQL Server Programmer
"Ice Man" <ehc00@hotmail.com> wrote in message
news:OqRSGUiTEHA.2464@TK2MSFTNGP10.phx.gbl...[color=blue]
> 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,
>
>[/color]


  #3  
Old July 19th, 2005, 01:43 PM
Aaron [SQL Server MVP]
Guest
 
Posts: n/a
Default Re: Date in SQL: 1/1/1900

(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.

--
http://www.aspfaq.com/
(Reverse address to reply.)




"Ice Man" <ehc00@hotmail.com> wrote in message
news:OqRSGUiTEHA.2464@TK2MSFTNGP10.phx.gbl...[color=blue]
> 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,
>
>[/color]


  #4  
Old July 19th, 2005, 01:43 PM
Ice Man
Guest
 
Posts: n/a
Default Re: Date in SQL: 1/1/1900

Thanks a lot Guys it worked! :)


"Roji. P. Thomas" <lazydragon@nowhere.com> wrote in message
news:upEGYZiTEHA.164@TK2MSFTNGP12.phx.gbl...[color=blue]
> 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')"
>
>
> --
> Roji. P. Thomas
> SQL Server Programmer
> "Ice Man" <ehc00@hotmail.com> wrote in message
> news:OqRSGUiTEHA.2464@TK2MSFTNGP10.phx.gbl...[color=green]
> > 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[/color][/color]
gives[color=blue][color=green]
> > me in the trnsdate and sysrecorddate the value: 1/1/1900
> >
> > Could sombody help me?
> >
> > Regards,
> >
> >[/color]
>
>[/color]


  #5  
Old July 19th, 2005, 01:43 PM
Aaron [SQL Server MVP]
Guest
 
Posts: n/a
Default Re: Date in SQL: 1/1/1900

Great, can you fix your system clock now?

--
http://www.aspfaq.com/
(Reverse address to reply.)




"Ice Man" <ehc00@hotmail.com> wrote in message
news:#Nm5xgiTEHA.2408@tk2msftngp13.phx.gbl...[color=blue]
> Thanks a lot Guys it worked! :)
>
>
> "Roji. P. Thomas" <lazydragon@nowhere.com> wrote in message
> news:upEGYZiTEHA.164@TK2MSFTNGP12.phx.gbl...[color=green]
> > 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')"
> >
> >
> > --
> > Roji. P. Thomas
> > SQL Server Programmer
> > "Ice Man" <ehc00@hotmail.com> wrote in message
> > news:OqRSGUiTEHA.2464@TK2MSFTNGP10.phx.gbl...[color=darkred]
> > > 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[/color][/color]
> gives[color=green][color=darkred]
> > > me in the trnsdate and sysrecorddate the value: 1/1/1900
> > >
> > > Could sombody help me?
> > >
> > > Regards,
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


  #6  
Old July 19th, 2005, 01:46 PM
Ice Man
Guest
 
Posts: n/a
Default Re: Date in SQL: 1/1/1900

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.



"Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:e%23OdH1iTEHA.1172@TK2MSFTNGP11.phx.gbl...[color=blue]
> Great, can you fix your system clock now?
>
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
>
>
> "Ice Man" <ehc00@hotmail.com> wrote in message
> news:#Nm5xgiTEHA.2408@tk2msftngp13.phx.gbl...[color=green]
> > Thanks a lot Guys it worked! :)
> >
> >
> > "Roji. P. Thomas" <lazydragon@nowhere.com> wrote in message
> > news:upEGYZiTEHA.164@TK2MSFTNGP12.phx.gbl...[color=darkred]
> > > 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')"
> > >
> > >
> > > --
> > > Roji. P. Thomas
> > > SQL Server Programmer
> > > "Ice Man" <ehc00@hotmail.com> wrote in message
> > > news:OqRSGUiTEHA.2464@TK2MSFTNGP10.phx.gbl...
> > > > Greetings
> > > >
> > > > I'm building an insert SQL statement then doing a response.write[/color][/color][/color]
then[color=blue][color=green][color=darkred]
> > > > 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[/color]
> > gives[color=darkred]
> > > > me in the trnsdate and sysrecorddate the value: 1/1/1900
> > > >
> > > > Could sombody help me?
> > > >
> > > > Regards,
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles