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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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