I wrote this code trying to know the relations amongs other tables from my BD but it didn´t bring nothing.
USE tuBaseDeDatos;
GO DECLARE @tabName AS Varchar(50)
SET @tabName = 'dbo.TU_TABLA'--table´s name from fk´s are goint to get
SELECT OBJECT_NAME(f.constid) AS 'FKName', c.name AS 'ColName'
FROM sysforeignkeys f INNER JOIN syscolumns c
ON f.fkeyid = c.id AND f.fkey = c.colid
WHERE fkeyid = OBJECT_ID(@tabName)

Laxmidhar SahooPosted Nov 8, 2018, 10:35 PM
Sourav MukherjeePosted Dec 6, 2018, 4:19 PM
Ramon QuintanaPosted Nov 12, 2018, 8:29 AM
Ramon QuintanaPosted Nov 12, 2018, 8:22 AM
Ramon QuintanaPosted Nov 12, 2018, 8:14 AM
GO
/****** Object: StoredProcedure [dbo].[Ver_FK] Script Date: 12/11/2018 11:11:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Procedure [dbo].[Ver_FK]
as
begin
exec sp_fkeys'dbo.VFS_AFV'
end
Laxmidhar SahooPosted Nov 9, 2018, 1:48 AM
Sreekanth ReddyPosted Nov 9, 2018, 12:34 AM
Vincent Maverick DuranoPosted Nov 8, 2018, 4:28 PM