sql SQL:SMP资源关联父/子
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql SQL:SMP资源关联父/子相关的知识,希望对你有一定的参考价值。
DECLARE @Guid uniqueidentifier
SET @Guid = ''
-- Find parents
SELECT
[conn1].*
, [ParentResourceName] = (SELECT [Name] FROM [vItem] WHERE [Guid] = [conn1].[ParentResourceGuid])
, [ChildResourceName] = (SELECT [Name] FROM [vItem] WHERE [Guid] = [conn1].[ChildResourceGuid])
, [conn2].[Name]
FROM
[ResourceAssociation] [conn1]
LEFT JOIN [vItem] [conn2] ON [conn1].[ResourceAssociationTypeGuid] = [conn2].[Guid]
WHERE [conn1].[ParentResourceGuid] = @Guid
-- Find children
SELECT
[conn1].*
, [ParentResourceName] = (SELECT [Name] FROM [vItem] WHERE [Guid] = [conn1].[ParentResourceGuid])
, [ChildResourceName] = (SELECT [Name] FROM [vItem] WHERE [Guid] = [conn1].[ChildResourceGuid])
, [conn2].[Name]
FROM
[ResourceAssociation] [conn1]
LEFT JOIN [vItem] [conn2] ON [conn1].[ResourceAssociationTypeGuid] = [conn2].[Guid]
WHERE [conn1].[ChildResourceGuid] = @Guid
以上是关于sql SQL:SMP资源关联父/子的主要内容,如果未能解决你的问题,请参考以下文章
带有相关子查询的 While 循环的 SQL Server 性能调整
sql SQL:[SMP]隐藏补丁启动窗口
sql SQL:所有可用的SMP报告
sql SQL / SMP:列出自动化策略
sql SQL / SMP:显示许可证计数
sql SQL:SMP托管与非托管计数