Re: Simple SQL Question

From: Brian Bushay TeamB (BBushay_at_Nmpls.com)
Date: 12/23/04


Date: Thu, 23 Dec 2004 11:00:57 -0600


>Im trying to construct a sql qry that Im going to execute via ado.
>1. How do I set a SQL qry to search dd/mm/yyyy format? ie 25/12/2004

ADO doesn't have anything to do with the date format that is dependent on the
database you use. MS SQL server bases date format on the language driver that
your login uses. If no default language driver is set US date format
(mm/dd/yyyy) is used
If you want freedom form database dateformat then use parameters in your query
for date values

>2. I would like to check that I dont have any schedule overlaps before
>making a booking.
>ie
>AccNo FromDate ToDate
>a010101 09/01/2004 12/01/2004
>
>How would I go about checking that my new schedule dates dont conflict\fall
>between these dates using a sql statement?
>
>Im sure the answers are fairly simple, Im just not thinking.

There are basically 3 possibilities you need to check for
The Date range you need to check for conflicts overlaps another date range at
the begriming of its range, at the end of its range or that an existing date
range falls with in your new date range.
So this SQL which uses parameters for the dates you are checking for will return
0 records if there is no conflict

Select * from your Table
where ( :bgnDate1 between FromDate and ToDate) or
 ( :endDate1 between FromDate and ToDate) or
or (FromDate between :bgnDate2 and :EndDate2)

--
Brian Bushay (TeamB)
Bbushay@NMPLS.com


Relevant Pages

  • Re: GEDOM as a database format
    ... industrial-strength SQL databases like SQL Server and Oracle. ... I worked in the area of multi-dimensional database ... your database to some format that the utility understands, ... Subject: re GEDCOM ...
    (soc.genealogy.computing)
  • Re: Create Non Access DB with VB??
    ... but then that isn't really a database. ... Application and the "MDB" file format, yet their is a distinction between ... > And then just write a VB app to interact with one of those! ... You could also do it with ASP using either Access or SQL ...
    (microsoft.public.vb.database)
  • Re: GridView basics
    ... I must format is e.Row.DataItem.ItemArray, ... On 31 aug, 14:56, "Eliyahu Goldin" ... database. ... end up with a bulky sql. ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)
  • Re: Linking SQL Server 2000 to Access - Bigint datatype
    ... I'm using Access 2003 to generate the database, ... I did try converting it to Access 2002-2003 format using the ... >> I'm currently trying to create an Access database that has links to SQL ... I've narrowed down the issue to the bigint datatype; ...
    (microsoft.public.sqlserver.odbc)
  • Re: Linking SQL Server 2000 to Access - Bigint datatype
    ... I'm using Access 2003 to generate the database, ... I did try converting it to Access 2002-2003 format using the ... >> I'm currently trying to create an Access database that has links to SQL ... I've narrowed down the issue to the bigint datatype; ...
    (microsoft.public.sqlserver.server)