thanks but dateasgn and datecomp will always be a business date. the difference between them is the problem nights and weekends get included. Question: Can I write a function in SQLServer like in PLSQL and call that function from within an SQL query? "Hayes, David" <[EMAIL PROTECTED]> wrote: Look at the DATEPART function. -----Original Message----- From: Alex [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 27, 2001 1:31 PM To: CF-Talk Subject: SQL Business Dates I have a query ... SELECT AVG(DATEDIFF(minute, dateasgn, datecomp)) AS diff FROM tblprob WHERE priority = 'urgent' AND datecomp IS NOT NULL AND status = 'closed' AND dateasgn >= '#form.startdate#' AND dateasgn <= '#form.endDate#' but I only want the business dates (no weekends or nights; just 9AM to 5PM Mon to Fri) This is in SQLServer. Any help appreciated. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

