Pronaći kolonu po nazivu u tabelama

Često je potrebno pronaći određenu kolonu po nazivu, a da ne znamo u kojoj tabeli ili tabelama se nalazi.Za to možete iskoristiti jednu od ove dvije skripte:

SELECT c.name AS ColName, t.name AS TableName
FROM sys.columns c
    JOIN sys.tables t ON c.object_id = t.object_id
WHERE c.name LIKE '%NazivKolone%'

ili

SELECT COLUMN_NAME, TABLE_NAME 
FROM INFORMATION_SCHEMA.COLUMNS 
WHERE COLUMN_NAME LIKE '%NazivKolone%'

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *