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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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