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
 Other Topics
 Date Conversion

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-13 : 08:47:02
Paddy writes "Assume I had the following columns and table_name:

Table: s_emp

Columns: emp_last_name (VARCHAR2), emp_first_name (VARCHAR2), start_date (DATE)


Question:

Display the employee name (Display like the following - Doe, John), the date they were hired (start_date) and the day of the week they started sorted by day of the week starting with Monday.

** I am able to do everything except increase the day of the week by 1 to Monday. Sunday is the default because it is the first day of the week. Can you show me how to do this? I have enclosed my code so you can check it and fix it **


set headsep !

column FullName heading 'Employee!Name' format a30
column start_date heading 'Hiring!Date'
column Day_Hired heading 'Day!Hired'


SELECT emp_last_name || ', ' || emp_first_name AS FullName, start_date,
TO_CHAR(Start_Date,'DAY') AS Day_Hired
FROM s_emp
ORDER BY TO_CHAR(Start_Date,'D');"

Nazim
A custom title

1408 Posts

Posted - 2002-03-13 : 09:19:31
Aha! you are using Oracle.

First thing move from Oracle to sql Server .


--------------------------------------------------------------
Go to Top of Page

joldham
Wiseass Yak Posting Master

300 Posts

Posted - 2002-03-13 : 09:25:08
The wonders of Oracle. I'll give you a hint. Try adding one to the day somewhere in your SQL statement. Be advised that this is a Microsoft SQL Server newsgroup.

Jeremy



Edited by - joldham on 03/13/2002 09:26:11

Edited by - joldham on 03/13/2002 09:56:04
Go to Top of Page
   

- Advertisement -