tds-fdw / tds_fdw

A PostgreSQL foreign data wrapper to connect to TDS databases (Sybase and Microsoft SQL Server)
Other
380 stars 102 forks source link

ERROR: DB-Library error: DB #: 20018 [...] Level: 16, #138

Open Karlodun opened 7 years ago

Karlodun commented 7 years ago

ERROR: DB-Library error: DB #: 20018, DB Msg: General SQL Server error: Check messages from the SQL Server, OS #: -1, OS Msg: , Level: 11 or Level: 16 SQL state: HV00L Using tsql I can connect and execute queries. Error reporting (msg_handling) is on 'notice' but does not give me any additional info :-( FreeTDS is the actual one from epel-repository. (if I compile git version, I receive the same error) The tds_fdw is from the 'official' yum.postgresql.org repo (CentOS 7)

Arief6684 commented 7 years ago

I am to get error like this,

SQL Error [HV00L]: ERROR: DB-Library error: DB #: 20018, DB Msg: General SQL Server error: Check messages from the SQL Server, OS #: -1, OS Msg: , Level: 16 Help me please, I try to access MSSQL database from a PostgreSQL database by using FreeTDS and tds_fdw, if I am excute this query "SELECT code FROM public.sap_oitt;" but always I get Error like this

SQL Error [HV00L]: ERROR: DB-Library error: DB #: 20018, DB Msg: General SQL Server error: Check messages from the SQL Server, OS #: -1, OS Msg: , Level: 16

AndrewGrossman commented 7 years ago

You need to check the log on the SQL Server to determine what the error is.

moopmonster commented 4 years ago

I encountered this error as well and found that my foreign table was referencing columns that don't exist. The error disappeared once I got the column names right (do check if you have case sensitive columns as well).

For me, to reproduce:
on SQL Server : create table animal ( id int, name varchar(50) );

and on PG : create foreign table fdw_animal ( id int, zzz varchar(50) ) server myserver OPTIONS(...);

select * from fdw_animal gives the error.

SQL Error [HV00L]: ERROR: DB-Library error: DB #: 20018, DB Msg: General SQL Server error: Check messages from the SQL Server, OS #: -1, OS Msg: , Level: 16

Was unable to locate any logs on the SQL server. Hope this helps.