BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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;
1 REPLY 1
Damo
SAS Employee
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,

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1899 views
  • 0 likes
  • 2 in conversation