Return to Snippet

Revision: 16328
at July 31, 2009 03:56 by marcocs


Initial Code
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%'

Initial URL

                                

Initial Description
Buscar tablas por tipo de columnas;
Note:AND OBJECT_NAME(object_id) NOT LIKE 'sy%': cuidado si tienes tablas que empiezan con "sy%"

Initial Title
Buscar tablas por tipo de columnas

Initial Tags

                                

Initial Language
SQL