Desktop productivity for business analysts and programmers

Assigning Libname to ODBC for multiple databases in sql server

Reply
N/A
Posts: 0

Assigning Libname to ODBC for multiple databases in sql server

I have two database db1 and db2 in sql server. I want to assign a single libname odbc to use tables residing in different database. I used qualifier option but it did not worked. Such that with single SYS1 i can get tables or views in database db1 and db2. How is that possible?

LIBNAME SYS1 ODBC DSN = "data_src" USER = userid PASSWORD = password SCHEMA = dbo QUALIFIER=databasename PRESERVE_TAB_NAMES = YES;
SAS Employee
Posts: 68

Re: Assigning Libname to ODBC for multiple databases in sql server

Hi SASQ,

The libname engine is setup as one library per schema/datasource.
You can setup several libraries for each database and then create one concatenated library that contains all the libraries.
If there are duplicate tables you will access the one listed first in the library.
Also, if you write to your DBMS it will write in first schema.
So, this method can yield results that you don't intend.

It could look likes this ;
libname test1 [...];
libname test2 [...];

libname all (test1 test2);

Hope that helps
Cheers,
Ask a Question
Discussion stats
  • 1 reply
  • 265 views
  • 0 likes
  • 2 in conversation