Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: one for the SQL experts - dare I say TRICKY SQL!
Tony Rogerson wrote:
>
> > Standard to which DBMS? Certainly not Oracle. I will submit passing
> > date strings without a proper format specifier is poor coding:
>
> The ISO standard rather than vendor specific.
>
> > INSERT INTO Threads ( thread_id, start_stamp, stop_stamp )
> > VALUES(1, convert(datetime, '2006-02-07 02:03:00', 120),
> > convert(datetime, '2006-02-07 02:07:00', 120))
>
> You do not and would not code it like that in SQL Server, you would simply
> write...
>
> INSERT INTO Threads ( thread_id, start_stamp, stop_stamp )
> VALUES(1, '2006-02-07T02:03:00', '2006-02-07T02:07:00') [snip]
Not sure which difference you mean.
The whole purpose of using the ISO 8601 format is that you don't need to specify the converting mode. So I would omit it too.
But I would probably also specify the datetime as '2006-02-07 02:07:00'. I still use SQL 7.0, and this format is upwards compatible. The format '2006-02-07T02:07:00' is harder to read, and needs at least SQL Server 2000.
Gert-Jan Received on Sat Feb 11 2006 - 06:34:48 CST