querying ssisdb to find the name of packages

血红的双手。 提交于 2020-07-18 12:35:09

问题


i was querying the ssis catlog to find out the name of all the packages in the catalog.
There are only 6 packages in the Folder1 project,but the query gives 9 records

 1. SELECT P.NAME FROM SSISDB.internal.projects PRJ INNER JOIN
    SSISDB.internal.packages P ON
    P.project_version_lsn=PRJ.object_version_lsn WHERE
    PRJ.NAME='Folder1'

Does it show the deleted packages from the project as well.


回答1:


They aren't deleted, that's part of the historical tracking. You likely wanted a query more similar to

SELECT
    F.name AS FolderName
,   P.name AS ProjectName
,   PKG.name AS PackageName
FROM
    ssisdb.catalog.folders AS F
    INNER JOIN 
        SSISDB.catalog.projects AS P
        ON P.folder_id = F.folder_id
    INNER JOIN
        SSISDB.catalog.packages AS PKG
        ON PKG.project_id = P.project_id
ORDER BY
    F.name
,   P.name
,   PKG.name;

This reflects that Folders contain Projects and Projects contain Packages so that will provide the exact "address" for a given package.




回答2:


The [SSISDB].[internal].[packages] table and other internal tables can contain multiple versions of your packages.

You should use the catalog views.

SELECT [projects].[name], [packages].[name], *
FROM [SSISDB].[catalog].[packages]
INNER JOIN [SSISDB].[catalog].[projects]
    ON [packages].[project_id] = [projects].[project_id]
ORDER BY [packages].[name]

The catalog views will return only the active objects.



来源:https://stackoverflow.com/questions/40467316/querying-ssisdb-to-find-the-name-of-packages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!