Advertisement

07.13.2005 at 08:49AM PDT, ID: 21490130
[x]
Attachment Details

SQL Reporting - convert datetime to date only format

Asked by zoseri in SQL Reporting

Tags: , , ,

Hi,

I think this is a simple question but I am just not sure how to do it right, as a newbie.

All I want to do is generate a report of company employees grouped by their date of hire.

SELECT DateOfHire, FirstName, LastName from Empls
ORDER BY DateOfHire

The only problem is that the DateOfHire displays as, e.g., '01/03/2004 12:00:00' which is not what I want.  I SIMPLY WANT TO OMIT THE TIME PART but don't know quite how to say this.  I tried several variations along this line but it causes scoping errors...

SELECT     CONVERT(Varchar(10), DateOfHire, 101) AS DOHDateOnly, FirstName, LastName, State
FROM         EMPL
GROUP BY DOHDateOnly

but this gives error

"The value expression for the textbox ‘DateOfHire’ refers to the field ‘DOHDateOnly’.  Report item expressions can only refer to fields within the current data set scope or, if inside an aggregate, the specified data set scope."

Which makes sense, but I don't know HOW to say the right thing to get what I want.

Any help will be greatly appreciated.  Need quick response, points assigned accordingly.
Start Free Trial
[+][-]07.14.2005 at 01:16AM PDT, ID: 14438489

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.14.2005 at 07:38AM PDT, ID: 14441222

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.14.2005 at 07:43AM PDT, ID: 14441298

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.14.2005 at 10:48AM PDT, ID: 14443340

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.14.2005 at 10:51AM PDT, ID: 14443377

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.14.2005 at 11:26AM PDT, ID: 14443658

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.14.2005 at 11:33AM PDT, ID: 14443744

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.14.2005 at 11:47AM PDT, ID: 14443889

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Reporting
Tags: date, sql, datetime, convert
Sign Up Now!
Solution Provided By: Navicerts
Participating Experts: 2
Solution Grade: B
 
 
[+][-]08.07.2005 at 02:58PM PDT, ID: 14619609

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32