JaniH
JaniH

Reputation: 59

querying sys.dm_db_index_physical_stats not working

I am trying to check the fragmentation of my table indexes in Azure synapse studio with query

SELECT 
    DB_NAME(ips.database_id) AS DatabaseName,
    OBJECT_NAME(ips.object_id) AS TableName,
    si.name AS IndexName,
    ips.avg_fragmentation_in_percent
FROM 
    sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, 'LIMITED') ips
INNER JOIN 
    sys.indexes si ON ips.object_id = si.object_id

But for some reason i keep getting error: Incorrect syntax near 'DB_ID'. And cant figure why. Any tips?

Upvotes: 1

Views: 158

Answers (1)

Razvan Socol
Razvan Socol

Reputation: 5694

The sys.dm_db_index_physical_stats function is not available in Azure Synapse Analytics.

Upvotes: 0

Related Questions