Advertisement
EmilianoRoldanR

Saber en cuantas tablas existe una columna con determinado nombre

Dec 29th, 2023 (edited)
1,409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.30 KB | None | 0 0
  1. --Saber que tablas de una base de datos sqlserver tienen un atributo llamado "nombredelatributo".
  2.  
  3. SELECT t.name AS NombreTabla,
  4.        c.name AS NombreColumna
  5. FROM sys.TABLES t
  6. INNER JOIN sys.COLUMNS c ON t.object_id = c.object_id
  7. WHERE LOWER(c.name) = ''; --Nombre del atributo va en esas comillas
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement