An error occurs when you try to insert data into a Microsoft SQL Server table by using the FreeTDS driver


Using SAS/ACCESSreg; Interface to ODBC and the FreeTDS driver to insert data into a Microsoft SQL Server database can result in an error stating that the table does not exist. You might receive this error even though the table does exist and can be accessed with other SAS code.

The following example illustrates code in which the DSN=data-source is defined in order to use the FreeTDS driver for Microsoft SQL Server. The error follows the code sample.

libname mylib odbc dsn=data-source user=user-id password=password;

proc sql;
   insert into mylib.mytable(value1, value) select val1, val2 from work.temptable;
quit;


ERROR: File MYLIB.MYTABLE.DATA does not exist.


The problem occurs because the FreeTDS driver does not support the cursor library. As a workaround for this problem, include the option USE_ODBC_CL=YES in the LIBNAME statement, as follows:

libname mylib odbc dsn=data-source user=user-id     
                   password=password use_odbc_cl=yes;