/ Published in: SQL
Buscar tablas por tipo de columnas;
Note:AND OBJECT_NAME(object_id) NOT LIKE 'sy%': cuidado si tienes tablas que empiezan con "sy%"
Note:AND OBJECT_NAME(object_id) NOT LIKE 'sy%': cuidado si tienes tablas que empiezan con "sy%"
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
USE MYDB GO DECLARE @VALUE NVARCHAR(128); SELECT @VALUE = 'text'; -- Tipo 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.user_type_id = TYPE_ID('text') AND OBJECT_NAME(object_id) NOT LIKE 'sy%'