Kategorien
Allgemeines

T-SQL read tables and columns from a linked server

SELECT lst.name AS Table_Name, 
       lsc.name AS Column_Name, 
       lsc.max_length, 
       (schema_id) As Schema_name

FROM [SERVER].[DB].[sys].[tables] lst
    INNER JOIN [SERVER].[DB].[sys].[columns] lsc
        ON lst.OBJECT_ID=lsc.object_id

ORDER BY schema_name, lst.name, lsc.name

Schreibe einen Kommentar