Home Forums SQL Server 2005 Development Select Statements in Stored Procedure gets Error converting data type DBTYPE_DBTIMESTAMP to datetime. RE: Select Statements in Stored Procedure gets Error converting data type DBTYPE_DBTIMESTAMP to datetime.

  • ERROR: Error converting data type DBTYPE_DBTIMESTAMP to datetime

    If you get this error in SQL, while doing an OPENQUERY SELECT on PROGRESS tables (or SQL92 data). The problem is there is an offending record with an unallowed date. Just convert each datetime field in the OPENQUERY part of your select, adding date fields one at a time and testing, until you find the offending date field that has an unallowed date.

    HOW:

    SELECT * INTO sqlTBLname FROM OPENQUERY(LINKEDSRVRNAME, 'SELECT { fn CONVERT("start-date", SQL_CHAR)} as STARTDATE FROM PUB."tblname" ')

    After you get it into a SQL table, then just sort on the year, right(datefield,4), and find the offending date. It probably is some date before 1900 (01/30/1630).

    CynthiaCols: "we can all make the world a better place, by simply sharing our view of the details, and by not assuming common knowledge".