Test

mail@pastecode.io avatar
unknown
sqlserver
2 years ago
360 B
3
Indexable
Never
select schema_name(tab.schema_id) as [schema_name], 
    tab.[name] as table_name
from sys.tables tab
    left outer join sys.indexes pk
        on tab.object_id = pk.object_id 
        and pk.is_primary_key = 1
where pk.object_id is null -- and tab.[name] in (select [column_name] from [table_name])
order by schema_name(tab.schema_id),
    tab.[name]