[archive] XODBC Error

[Migrated content. Thread originally posted on 10 June 2010]

Hi, I'm experiencing a very strange issue.

Background:
Windows 2003 Server, MSSQL Server 2005, XODBC 8.1.0, AIX 5.3

Issue/Error:
OLE DB provider "MSDASQL" for linked server "(null)" returned message "[TOD][ODBC][GENESIS](pos: 133 '...A_SELECT='Y'^Y'') - syntax error".

Currently, I'm only running 2 SQL statements. If I run statement 'A' first, then run 'B', 'B' will fail with this error. If I run 'B' first, it runs fine, and 'A' will run fine.

If after 'B' fails, I wait for a couple of minutes, 'B' will run fine (by itself).

I'm running these from SQL Enterprise Manager. The two Selects are shown below in the the order where the second one always gets the error message:

SELECT a.* from OPENROWSET('MSDASQL', 'DSN=BSFUNIXk',
'select
comnum, comnum_sub, comheading, comheading_sub
from ROOT.comheadfl comheadfl
where comheadfl.comnum=6980 and comheadfl.comheading_sub is not null
' ) as a

SELECT a.* from OPENROWSET('MSDASQL', 'DSN=BSFUNIXk',
'select lf_login, lf_password from ROOT.wlogins wlogins where wlogins.lf_login=''haverty1'' and wlogins.lf_password=''DarT''
' ) as a

Any ideas/suggestions would be most appreciated.