Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Element115
Super User
Super User

QUESTION::SQL ENDPOINT::INFORMATION_SCHEMA::QUERY RETURN NOTHING

Why do the following 2 TSQL queries return an empty result set?  Also nothing with a WHERE clause on a table name in the LH.

 

 

SELECT *
FROM INFORMATION_SCHEMA.VIEW_COLUMN_USAGE

 

 

 

SELECT *
FROM INFORMATION_SCHEMA.VIEW_TABLE_USAGE

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Element115 
Create a view using table present in lakehouse and retry.

vnikhilanmsft_0-1716572585383.png

 

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Hi @Element115 
Thanks for using Fabric Community.
If you have any views in the lakehouse, then the queries will return some data.

For example:
I had no views in Lakehouse_2:

vnikhilanmsft_0-1716571066609.png


In other case I created a view in another lakehouse:

vnikhilanmsft_1-1716571111706.png


Hope this helps. Please let me know if you have any other questions.

Actually, I take back my previous answer.  I just tried running both TSQL queries on a LH that has a view, and as you can see in my screenshot, it does not work on my end:

 

Screenshot 2024-05-24 133215.jpg

Anonymous
Not applicable

Hi @Element115 

How did you create the view? Can you please share the code here?

If you create the view using the tables present in lakehouse, then it would be shown in the sql query result.

CREATE VIEW vTABLE_NAMES 
AS 
SELECT * 
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'dbo'
;
Anonymous
Not applicable

Hi @Element115 
Create a view using table present in lakehouse and retry.

vnikhilanmsft_0-1716572585383.png

 

In this case, with a VIEW on a user created table, it works.  

 

But why does it not work for VIEWs on the INFORMATION_SCHEMA?  Ahhh because they are all views in this schema and not tables. Duh.

Anonymous
Not applicable

Hi @Element115 

The information_schema.VIEW_TABLE_USAGE is an information schema view that returns one row for each table in the current database that is used in a view. Here the current database is the lakehouse. So if the view is created using the table present in lakehouse, then the data will be displayed in the information schema. This view provides information about the objects to which the current user has permissions.

Here are some of the columns you might find in information_schema.VIEW_TABLE_USAGE:

VIEW_CATALOG: View qualifier.
VIEW_SCHEMA: Name of schema that contains the view.
VIEW_NAME: View name.
TABLE_CATALOG: Table qualifier.
TABLE_SCHEMA: Name of schema that contains the base table.
TABLE_NAME: Base table that the view is based on.

Hope this helps. 

Oh I am sorry.  It's the column and table usage of any VIEWS.  I was reading this as the verb 'to view' the column and/or table usages of tables, not views.  Need another coffee.  😁  I have no views, so ofc it's empty.  Thanks.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Fabric Update Carousel

Fabric Monthly Update - October 2025

Check out the October 2025 Fabric update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.