SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Showing dates
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Christech82
Starting Member

Hungary
20 Posts

Posted - 04/13/2013 :  15:40:22  Show Profile  Reply with Quote
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

USA
1974 Posts

Posted - 04/13/2013 :  16:37:43  Show Profile  Visit chadmat's Homepage  Reply with Quote
SELECT DATEDIFF(dd, START_DATE, TERMINATION_DATE) DATES
FROM CONTRACT

-Chad
Go to Top of Page

Christech82
Starting Member

Hungary
20 Posts

Posted - 04/13/2013 :  16:49:22  Show Profile  Reply with Quote
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

USA
1974 Posts

Posted - 04/13/2013 :  17:21:25  Show Profile  Visit chadmat's Homepage  Reply with Quote
Looks like you are not using SQL Server.

-Chad
Go to Top of Page

Christech82
Starting Member

Hungary
20 Posts

Posted - 04/13/2013 :  17:43:02  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
6059 Posts

Posted - 04/13/2013 :  22:21:58  Show Profile  Reply with Quote
This forum is specific to MS Sql Server. Try the DBForums site.

Be One with the Optimizer
TG
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000