Re: Strange date/time anomaly, or am I just stoopid?



(teddysnips@xxxxxxxxxxx) writes:
> 1900-01-01 18:00:00 1900-01-02 00:00:00 1.2
>
> So, it's storing the time 23:59:59 as midnight. That's odd.

Not particularly. As noted by Damien, smalldatetime does fit any seconds.

> If I put the cursor in a new row, and type into the TimeFrom column
> 18:30:00 and the TimeTo column 19:30:00 and the RateMultiplier column
> 1.3, and refresh the data by pressing the red shriek !, I get this:
>
> 01/01/1900 18:00:00 01/01/1900 23:59:59 1.2
> 18:30:00 19:30:00 1.3
>
> If I re-run the SELECT from the QA, I get this:
>
> 1900-01-01 18:00:00.000 1900-01-01 23:59:59.000 1.2
> 1899-12-30 18:30:00.000 1899-12-30 19:30:00.000 1.3
>
> Is it just me, or does this seem to be remarkably inconsistent?

In SQL Server time zero is 1900-01-01 00:00:00.000

In other Microsoft environments - COM, Visual Basic etc - time zero is
1899-12-30 00:00:00.000. Apparently the junior programmer that was tasked
to do the Open Table function was not aware of this difference.

Well, no one forces you to use EM.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

.



Relevant Pages

  • Re: approach to creating a procedure that contains dll , dml to upgrade a system
    ... sure new data will fit in columns after the ddl is executed, ... One thing to remember is that SQL Server will first compile the ... In case you run into to it, the solution is to put troublesome statements ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: SmallDateTime
    ... Underneath the hood, it creates a SqlParameter of the proper type, so you ... Here is your corrected string: ... The second example will strongly type for SQL Server and will definitely ... convert from datetime to smalldatetime... ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Performance problem... again :(
    ... Hi Marco, ... but I'm afraid I can't give much advise - except ... an add-on to SQL Server. ... Server - I guess your current questions would fit best in that group). ...
    (microsoft.public.sqlserver.mseq)
  • Re: Data Driven Query - Lookup where Clause
    ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. ... > im trying to write a lookup query for a Data driven Query. ... > im trying to compare a string value from a text file to a smalldatetime value. ... > Ive tried converting the textfile value to '27/02/2004' but am getting nowhere ...
    (microsoft.public.sqlserver.dts)
  • Re: Moving Data Without CURSORS or Looping.
    ... SQL Server Books Online - within the SQL Server program group) for more ... as I read the BOL my procedural mind can only> come up with using a cursor to solve this. ... > wrk_days_per_week smallint NULL, ... > line_start_date smalldatetime NULL, ...
    (microsoft.public.sqlserver.programming)