working with dates in SQL


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: working with dates in SQL

  1. #1
    Join Date
    Apr 2005
    Posts
    7

    working with dates in SQL

    Hi guys, looking for help with a problem with a small database I am setting up.
    My dbase has only 2 tables which are

    Personal Table-
    Employee ID (primary key)
    First Name
    Last Name
    Address
    Phone No
    Mobile Phone
    Email
    DoB
    NPK (foreign Key)

    UKCC Table -
    NPK (primary key)
    Practice
    UKCC Number
    UKCC expiry date
    Working Hours
    No Of day worked
    PD review date

    Now the problem I have is when creating a query to 'flag up' expiry dates 30 day before it does expire. I have no problems in cretaing the SELECT statement or FROM statement (as is always the case), and most of the WHERE statement i.e. linking the tables.
    I know I cannot just subtract a integer from the expiry date, this is where I am struggling.
    Any help would be greatly appreciated.

  2. #2
    Join Date
    Jan 2006
    Posts
    13
    SQL Server? Take a look at the DATEDIFF function mate...

    Cheers,

    Paul

Similar Threads

  1. SQL Connectivity with Linked MS Access DB
    By David Croft in forum Database
    Replies: 0
    Last Post: 08-13-2003, 12:45 PM
  2. Problem with Serialized dates in SQL Server/VB
    By Eric Litwin in forum VB Classic
    Replies: 0
    Last Post: 09-24-2002, 10:13 AM
  3. Problems getting dates programmatically into SQL Server
    By James Lewis in forum VB Classic
    Replies: 1
    Last Post: 04-02-2001, 06:44 AM
  4. VB & SQL Server 7 & dates
    By francois in forum VB Classic
    Replies: 1
    Last Post: 12-06-2000, 07:56 PM
  5. Re: ODBC error
    By Devaraj in forum Enterprise
    Replies: 0
    Last Post: 05-11-2000, 12:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center