Re: Finding the Shift for current hour



On Mon, 7 Nov 2005 05:21:02 -0800, Pradeep TN wrote:

>Hi Hugo Kornelis,
>
>Thank you very much for your reply. The query is working fine. However, I
>had to make one change in my data since the query failed on one condition.
>Since I was only interested in "time" part, I had not looked properly into
>the "date" part. When I insert rows for the given shift information, the
>"date" part defaults to '1899-12-30'. I am not sure why this is so, since the
>base date is supposed to be '1900-01-01'.

Hi Pradeep,

Are you using Enterprise Manager to isnert the data? For some mysterious
reason, the deveopers who wrote EM seem not to have tallked to the
developers who wrote the core data handling of SQL Server - instead of
asking them for the default date, they chose their own. 1899-12-30, as
you might have guessed.


>If you look at Shift B, it starts from 6 PM - 6AM. Now if '1899-12-30' is
>supposed to be by "base date" for this table, 6 AM represents 6 AM of
>'1899-12-31'. So made that change in the table and your query is working
>fine. Before this change, if my @EventMoment was '18:10:00', there were no
>rows returned.

Yeah, my query assumed that the times were stored with the correct
default date. Glad you were able to sort this last problem out by
yourself!

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
.



Relevant Pages

  • Re: Importing from another database on same server using SQL Server Express
    ... I thought this post was considered dead, so I elected to repost the ... "amish" on that group proved to work: ... Please post the COMPLETE query, ... Hugo Kornelis, SQL Server MVP ...
    (microsoft.public.sqlserver.msde)
  • Re: How To Return A "Range Of Rows"??
    ... SET ROWCOUNT. ... there are no rows returned by your query. ... the proc later tries to set a negative ROWCOUNT. ... Hugo Kornelis, SQL Server MVP ...
    (comp.databases.ms-sqlserver)
  • Re: Compare record count in table1 to qty in table2?
    ... Here is a query I'm trying to use and, of course, it does not work: ... INNER JOIN Item_Serial ... Hugo Kornelis, SQL Server MVP ...
    (comp.databases.ms-sqlserver)
  • Re: How To Return A "Range Of Rows"??
    ... Shouldn't I be seeing results with the column headers? ... this just to show that the query works in debug mode? ... Hugo Kornelis, SQL Server MVP ... My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis ...
    (comp.databases.ms-sqlserver)
  • Re: Source control integration with MSSQL 2000.
    ... I tested sqlXpress about a year or so ago. ... query plans, which was something I couldn't do without. ... > using both Query Analyzer and Enterprise Manager. ... > - Their website says "Replaces most features of Microsoft® Query Analyser ...
    (microsoft.public.sqlserver.server)