问题在标题:)。我需要知道它是否可能。
以下是如何为表格
执行此操作SELECT
OBJECT_NAME(f.parent_object_id) as tbl,
OBJECT_NAME(fc.referenced_object_id) as refTable,
COL_NAME(f.parent_object_id, fc.parent_column_id) as foreignKeyColumnName
FROM sys.foreign_keys f
INNER JOIN sys.foreign_key_columns AS fc ON f.OBJECT_ID = fc.constraint_object_id
WHERE f.parent_object_id = OBJECT_ID('dbo.TableName')
答案 0 :(得分:1)
视图通常只是基于表格的“预存”SELECT
语句。
视图本身在您的数据库中没有任何物理表示,因此,您没有视图上的外键 - 您在底层基表上有它们