Posted By

marcocs on 07/31/09


Tagged

admin Mantenimiento


Versions (?)

Buscar tablas por nombre de columnas


 / Published in: SQL
 

Buscar tablas por nombre de columnas;

  1. USE MYDB
  2. GO
  3.  
  4. DECLARE @Value NVARCHAR(128);
  5. SELECT @Value = 'ID'; -- Nombre a buscar
  6.  
  7. SELECT OBJECT_NAME(object_id) AS object_name,
  8. c.name AS column_name,
  9. TYPE_NAME(c.user_type_id) AS user_type_name,
  10. c.max_length
  11. FROM sys.COLUMNS AS c
  12. INNER JOIN sys.types AS t ON c.user_type_id = t.user_type_id
  13. WHERE c.name LIKE '%'+@Value+'%' AND OBJECT_NAME(object_id) NOT LIKE 'syn%'

Report this snippet  

You need to login to post a comment.