Re: DateTime



On Jun 19, 4:21 pm, roblowein <rob.low...@xxxxxxxxx> 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

.



Relevant Pages

  • Re: Using Function Table ? using Sql Server 2008
    ... which is basically a datetime version of your original. ... Special attention to execution plan detail is a good practice in such cases to ensure the query and indexes are as optimal as possible. ... @EndDate datetime ... SELECT DATEADD(day, N-1, @StartDate) ...
    (microsoft.public.sqlserver.programming)
  • Re: Problem with Jobs... Plz help!
    ... It don't even have a datetime field... ... is that the same error occurs on other jobs... ... > Wayne Snyder, MCDBA, SQL Server MVP ... > community of SQL Server professionals. ...
    (microsoft.public.sqlserver.server)
  • Re: Problem mit einer Softgrid DB
    ... Jobs werden gestartet aber werden nicht beendet. ... ROLLBACK TRANSACTION-Anweisung fehlt. ... Vorherige Anzahl = 1, aktuelle ... also irgendwo in der SP wird eine Konvertierung nach Datetime gemacht. ...
    (microsoft.public.de.sqlserver)

Loading