如何找到特定数据库的修改对象?

时间:2017-01-08 20:16:59

标签: tsql sql-server-2012

我是如何将特定数据库Adventureworksdw,NorthWind的以下更改作为单个结果集进行的。

-- Modified Tables
SELECT NAME, TYPE, TYPE_DESC, CREATE_DATE, MODIFY_DATE FROM SYS.OBJECTS 
WHERE TYPE ='U' ORDER BY MODIFY_DATE DESC

1 个答案:

答案 0 :(得分:0)

您可以使用以下查询。

SELECT 
    'Adventureworksdw' AS SourceDatabase,
    NAME, 
    TYPE, 
    TYPE_DESC, 
    CREATE_DATE, 
    MODIFY_DATE 
FROM Adventureworksdw.SYS.OBJECTS 
WHERE 
    TYPE ='U' 
UNION ALL
SELECT 
    'NorthWind ' AS SourceDatabase,
    NAME, 
    TYPE, 
    TYPE_DESC, 
    CREATE_DATE, 
    MODIFY_DATE 
FROM NorthWind.SYS.OBJECTS 
WHERE 
    TYPE ='U' 
ORDER BY MODIFY_DATE DESC