# Miscellaneous > Ask an Expert >  Error converting data type DBTYPE_DBTIMESTAMP to datetime.

## jason_limwk

sorry i am not sure where i have to post this.. but i also got the same erorr


Error converting data type DBTYPE_DBTIMESTAMP to datetime.

with my sql something like this

select DUE_DATE_END_OPER from openquery 
(MARS_PGS, 'select DUE_DATE_END_OPER from PG8_PROD_0_REPORT.F_HVE_APO_ROUTE')

could somebody help me explain?or any solution? as i am not good in sql..
thank you

----------


## rmiao

Tried this?

select convert(datetime, DUE_DATE_END_OPER) from openquery 
(MARS_PGS, 'select DUE_DATE_END_OPER from PG8_PROD_0_REPORT.F_HVE_APO_ROUTE')

----------


## anam

Hi -

I had similar issue a while back, and Mak was able to assist me.

Please see below thread:

http://forums.databasejournal.com/sh...ad.php?t=34278

Good luck.
LS

----------


## jason_limwk

thanks guy.... but i got the ans for it already....


to rmiao....
ur coding seems still got error  on it..~
hen i put it and analyst it,.. error coming ...

Server: Msg 8114, Level 16, State 8, Line 1
Error converting data type DBTYPE_DBTIMESTAMP to datetime.


to anam...
thanks for the link/... butsince i got the ans...~ so i din go there  but for sure i will go there to have a look on it.. thanks..


oo btw.. the coding that manage t o run should be...


select * 
from openquery(MARS_PGS, 'select TO_CHAR(DUE_DATE_END_OPER)  FormattedDate from PG8_PROD_0_REPORT.F_HVE_APO_ROUTE') derived 
where isdate(FormattedDate)=0  




thanks guy..~

----------

