Ejemplo que permite ver todas las llaves
primarias de las tablas de una base de datos.
---Llaves
primarias de una tabla
SELECT i.name AS NombreIndice,
OBJECT_NAME(ic.OBJECT_ID)
AS NombreTabla,
COL_NAME(ic.OBJECT_ID,ic.column_id)
AS NombreColumna
FROM sys.indexes AS i
INNER JOIN sys.index_columns AS ic ON i.OBJECT_ID = ic.OBJECT_ID
AND i.index_id = ic.index_id and i.is_primary_key = 1
No hay comentarios:
Publicar un comentario