Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Need Help ASAP!! date and age query

Author  Topic 

kixazz2529
Starting Member

1 Post

Posted - 2007-02-20 : 16:48:22
Hey,

I am trying to do teh following:

Move all records with invalid date of births or date of births under the age of 18 to a table i have created.

I have been trying to use the datediff( ) function in an if statement to grab the people who are under the age of 18 but i have had no luck.....if someone could please shed some light
the following is hwta i have tried but did not work:

INSERT INTO tblMemberDataScrubs ( EID, LastName, FirstName, Phone, Gender, DateOfBirth, S_Reason )
SELECT tblMemberData.EID, tblMemberData.LastName, tblMemberData.FirstName, tblMemberData.Phone, tblMemberData.Gender, tblMemberData.DateOfBirth, 'Invalid Date' AS S_Reason
FROM tblMemberData
WHERE (DATEDIFF("yyyy", DateOfBirth, GetDate( ))) <=18;



and also if you could shed some light on to how to move invalid dates as i am unsure of this

if you could please help me out....i need this ASAP

thank ytou very much in advance

-justin

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-21 : 01:00:20
Read this topic and see if it helps
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=74462


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -