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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1640 views
  • 0 likes
  • 2 in conversation