You are here: Re: DateTime « MsSQL Server « IT news, forums, messages
Re: DateTime

Posted by M A Srinivas on 06/19/07 11:53

On Jun 19, 4:21 pm, roblowein <rob.low...@gmail.com> wrote:
> Hello,
>
> Please can you point me in the right direction.
>
> I have a table (JobMain) that holds a list of all jobs that out
> engineers need to work on or have worked on.
>
> I would like to select jobs that fall between Monday - Friday 8am to
> 7pm.
>
> The tables holds a load of colums ... the two that are of interest to
> me are
>
> JobId (Primary Key) - Job Number
> StartDate (Datetime datatype) - Job start date and time
>
> regards
>
> Rob

DECLARE @startdate datetime ,@enddate datetime

SET @startdate = '2007-06-18 08:00:00' -- Monday 8 AM
SET @enddate = DATEADD(DD,4 ,DATEADD(HOUR,11,@startdate)) --

SELECT @startdate,@enddate

SELECT * FROM yourtable
WHERE StartDate BETWEEN @startdate AND enddate

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация