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
 to_char('YYYY') problem!!

Author  Topic 

sportsman667
Starting Member

4 Posts

Posted - 2007-04-16 : 15:33:17
I am trying to list all projects managed by technicians who joined in the year 2005 or later. the techno column is in both tables(test_technicians & test_projects) and the projno is only in the test_projects table. Whats wrong with my coding? I keep getting an error message that the FROM statement is in the wrong place

SELECT techno, projno Tstartdate
TO_CHAR(Tstartdate,'YYYY') AS Tech Start Date
FROM test_technicians, test_projects
WHERE test_technicians.techno = test_projects.techno
AND TO_CHAR(Tstartdate,'YYYY') >= '2005';

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-04-16 : 15:36:01
Are you using SQL Server? TO_CHAR() is not a valid function.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-04-16 : 15:37:26
Are you even using SQL Server? I'm not familiar with TO_CHAR function. SQL Server Books Online doesn't turn up anything, so I suspect either TO_CHAR is a custom function or you aren't using SQL Server.

SELECT techno, projno, Tstartdate, YEAR(Tstartdate) AS TechStartDate
FROM test_technicians
INNER JOIN test_projects
ON test_technicians.techno = test_projects.techno
WHERE Tstartdate >= '01-01-2005'


Tara Kizer
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

sportsman667
Starting Member

4 Posts

Posted - 2007-04-16 : 15:39:24
Im using oracle 10g
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-04-16 : 15:45:12
This is a Microsoft SQL Server forum. You might get better advice at a forum that specializes in Oracle, don't you think?

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

sportsman667
Starting Member

4 Posts

Posted - 2007-04-16 : 15:49:01
indeed. sorry :/
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2007-04-16 : 16:33:37
quote:
Originally posted by jsmith8858

Are you using SQL Server? TO_CHAR() is not a valid function.

- Jeff
http://weblogs.sqlteam.com/JeffS




TO_CHAR is Oracle



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-04-17 : 04:15:00
http://www.dbforums.com might be your best bet.

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-17 : 07:08:26
or
www.orafaq.com

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

mcrowley
Aged Yak Warrior

771 Posts

Posted - 2007-04-17 : 09:13:42
There is a missing comma or two in the select list.
Go to Top of Page

sshelper
Posting Yak Master

216 Posts

Posted - 2007-04-17 : 09:25:23
Try putting the "Tech Start Date" column alias in quotes since it has spaces in them :

SELECT techno, projno Tstartdate
TO_CHAR(Tstartdate,'YYYY') AS "Tech Start Date" FROM test_technicians, test_projects
WHERE test_technicians.techno = test_projects.techno
AND TO_CHAR(Tstartdate,'YYYY') >= '2005';


SQL Server Helper
http://www.sql-server-helper.com
Go to Top of Page
   

- Advertisement -