Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select OpenQuery with date comversion.

Status
Not open for further replies.

joejack0330

Technical User
Jan 27, 2006
95
US
Hi, trying to run an select with openquery in sql 2005 to select data from a linked oracle database. It works fine but trying to use convert on a date field and says missing expression. Is it possibly because of commas within the convert expression not correct?

SELECT *
FROM OPENQUERY(APP4, 'SELECT file#, file# as clock#, lastname, firstname, socialsecurity#, status, 999999, ratetype, 888888, companycode, homedepartment, homejob, ratetype as ratecode, CONVERT(CHAR(10),getdate(),101) as hiredate, rehiredate, terminationdate, birthdate from reports.v_emp_all')

Thanks,
Joe
 
Mistake: Sorry, the getdate() was just for testing, actually used valid field called hiredate.
 
Fixed: I needed to use Oracle conversion statement.

SELECT *
FROM OPENQUERY(APP4, 'SELECT file#, file# as clock#, lastname, firstname, socialsecurity#, status, 999999, ratetype, 888888, companycode, homedepartment, homejob, ratetype as ratecode, TO_CHAR(hiredate, ''MM/DD/YYY'') as DateHired, rehiredate, terminationdate, birthdate from reports.v_emp_all')
 
HAve you tried the Oracle equivalent of convert?

"NOTHING is more important in a database than integrity." ESquared
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top