Buscar tablas por nombre de columnas


/ Published in: SQL
Save to your folder(s)

Buscar tablas por nombre de columnas;


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.