码迷,mamicode.com
首页 > 其他好文 > 详细

查看外键属性

时间:2014-11-10 17:18:11      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:des   http   io   ar   os   sp   for   on   cti   

USE AdventureWorks2012;
GO
SELECT 
    f.name AS foreign_key_name
   ,OBJECT_NAME(f.parent_object_id) AS table_name
   ,COL_NAME(fc.parent_object_id, fc.parent_column_id) AS constraint_column_name
   ,OBJECT_NAME (f.referenced_object_id) AS referenced_object
   ,COL_NAME(fc.referenced_object_id, fc.referenced_column_id) AS referenced_column_name
   ,is_disabled
   ,delete_referential_action_desc
   ,update_referential_action_desc
FROM sys.foreign_keys AS f
INNER JOIN sys.foreign_key_columns AS fc 
   ON f.object_id = fc.constraint_object_id 
WHERE f.parent_object_id = OBJECT_ID(‘HumanResources.Employee‘);
转自:http://msdn.microsoft.com/zh-cn/library/ms190196.aspx

查看外键属性

标签:des   http   io   ar   os   sp   for   on   cti   

原文地址:http://www.cnblogs.com/coolsxh/p/4087426.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!