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
 General SQL Server Forums
 New to SQL Server Programming
 Showing dates

Author  Topic 

Christech82
Starting Member

20 Posts

Posted - 2013-04-13 : 15:40:22
How to show hire days I mean I have made this query to get the hire date

SELECT MONTHS_BETWEEN(START_DATE,TERMINATION_DATE) DATES
FROM CONTRACT;
The result should be how many days between the start date and the termination date but I have always wrong result!!!?

columns are :

START_DATE TERMINATION_DATE
---------- ----------------
30-JAN-13 20-FEB-13
01-DEC-12 12-FEB-13
02-FEB-12 05-APR-12
10-FEB-10 15-FEB-11
07-JUN-12 10-DEC-12
15-DEC-12 20-DEC-13






chadmat
The Chadinator

1974 Posts

Posted - 2013-04-13 : 16:37:43
SELECT DATEDIFF(dd, START_DATE, TERMINATION_DATE) DATES
FROM CONTRACT

-Chad
Go to Top of Page

Christech82
Starting Member

20 Posts

Posted - 2013-04-13 : 16:49:22
quote:
Originally posted by chadmat

SELECT DATEDIFF(dd, START_DATE, TERMINATION_DATE) DATES
FROM CONTRACT

-Chad



Thank you for your reply

DATEDIFF It's not working as I still have this message from oracle


Error starting at line 40 in command:
SELECT DATEDIFF(dd, START_DATE, TERMINATION_DATE)
FROM CONTRACT
Error at Command Line:40 Column:8
Error report:
SQL Error: ORA-00904: "DATEDIFF": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:





Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2013-04-13 : 17:21:25
Looks like you are not using SQL Server.

-Chad
Go to Top of Page

Christech82
Starting Member

20 Posts

Posted - 2013-04-13 : 17:43:02
quote:
Originally posted by chadmat

Looks like you are not using SQL Server.

-Chad



Yes, I using SQL developer
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2013-04-13 : 22:21:58
This forum is specific to MS Sql Server. Try the DBForums site.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -