필터 지우기
필터 지우기

Query specific catalog in MS SQL DB

조회 수: 2 (최근 30일)
Anthony Crockford
Anthony Crockford 2019년 1월 18일
답변: Arpan Badeka 2019년 4월 4일
Hi,
I need to query an MS SQL data base but I do not know how to select the specific catalog of interest.
Here is my SQL DB architechture:
xxxx.windows.net
- Databases
+ System Databases
+ Database1
+ Database2
...
The connection is defaulted to master catalog but I need tables in Database1, Database2 ...
I have the database toolbox installed and am running R2018a using ODBC Driver 17 for SQL Server.
Can anyone send a few lines of code to help?
Many thx indeed.

답변 (1개)

Arpan Badeka
Arpan Badeka 2019년 4월 4일
Hi Anthony
Use the following query after connecting to the database to get the list of all the tables:
tableList = sqlread(conn, "tables", 'Catalog', Database1, 'Schema', 'information_schema');

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by