/ Published in: SQL
Buscar tablas por nombre de columnas;
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
USE MYDB GO DECLARE @VALUE NVARCHAR(128); SELECT @VALUE = 'ID'; -- Nombre a buscar SELECT OBJECT_NAME(object_id) AS object_name, c.name AS column_name, TYPE_NAME(c.user_type_id) AS user_type_name, c.max_length FROM sys.columns AS c INNER JOIN sys.types AS t ON c.user_type_id = t.user_type_id WHERE c.name LIKE '%'+@VALUE+'%' AND OBJECT_NAME(object_id) NOT LIKE 'syn%'