Pages

Wednesday, June 1, 2022

1.Internal Tables

 

1.1         Internal Tables

-          https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-internal-tables-transact-sql?view=sql-server-2017

-          Internal tables are automatically generated by SQL Server to support various features.

-          Internal tables appear in the sys schema of every database and have unique, system-generated names that indicate their functions

-          Internal tables do not contain user-accessible data, and their schema are fixed and unalterable.

-          You cannot reference internal table names in Transact-SQL statements

-          However, you can query catalog views to see the metadata of internal tables.

-          The visibility of the metadata in catalog views is limited to securables that a user either owns or on which the user has been granted some permission

-          Internal tables are placed on the same filegroup as the parent entity

-          Objects

o   SELECT * FROM sys.objects WHERE type = 'IT'; 

o   SELECT * FROM sys.internal_tables; 

SELECT SCHEMA_NAME(itab.schema_id) AS schema_name 

,itab.name AS internal_table_name 

,typ.name AS column_data_type  

,col.* 

FROM sys.internal_tables AS itab 

JOIN sys.columns AS col ON itab.object_id = col.object_id 

JOIN sys.types AS typ ON typ.user_type_id = col.user_type_id 

ORDER BY itab.name, col.column_id;