博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
查询一段时间内修改过的存储过程
阅读量:6985 次
发布时间:2019-06-27

本文共 1524 字,大约阅读时间需要 5 分钟。

declare @Platform nvarchar(100) = '库名'

declare @Platform_BusinessData nvarchar(100) = '库名' 
declare @LastModifyDate nvarchar(100) = '2017-02-16 00:00:00'  --修改时间
declare @sql nvarchar(max) = '
if OBJECT_ID(''tempdb..#t'') is not null drop table #t
select *
    into #t
    from (
    select ''' + @Platform + '..'' + o.name + isnull(''.'' + tb.name, '''') name, o.create_date, o.modify_date,o.type_desc
        FROM ' + @Platform + '.sys.all_objects o
        left join ' + @Platform + '.sys.triggers t on t.object_id = o.object_id
        left join ' + @Platform + '.sys.tables tb on tb.object_id = t.parent_id
        union all
    select ''' + @Platform_BusinessData + '..'' + o.name + isnull(''.'' + tb.name, ''''), o.create_date, o.modify_date,o.type_desc
        FROM ' + @Platform_BusinessData + '.sys.all_objects o
        left join ' + @Platform_BusinessData + '.sys.triggers t on t.object_id = o.object_id
        left join ' + @Platform_BusinessData + '.sys.tables tb on tb.object_id = t.parent_id
    ) t
    where modify_date >=''' + @LastModifyDate + '''
--select distinct type_desc from #t
select * from #t
    where type_desc = ''USER_TABLE''
        
select * from #t
    where type_desc = ''SQL_STORED_PROCEDURE''
    
select * from #t
    where type_desc = ''SQL_SCALAR_FUNCTION'' or type_desc = ''SQL_TABLE_VALUED_FUNCTION''
    
select * from #t
    where type_desc = ''VIEW''
    
select * from #t
    where type_desc = ''SQL_TRIGGER''
'    
print @Sql
exec sp_executesql @sql
-- select * from UBIPlatform..HY_SOLUTION where SolutionName like 'Case%' or SolutionName like '%Review'

转载于:https://www.cnblogs.com/wancong/p/7228324.html

你可能感兴趣的文章
C++的字符串格式化库
查看>>
面向接口编程的好处和优点
查看>>
放过设计模式吧
查看>>
架构师必看-架构之美第14章-两个系统的故事:设计之城(一)
查看>>
从c++转到Python需要注意的地方
查看>>
HDU4756+Prim
查看>>
mysql 利用触发器(Trigger)让代码更简单
查看>>
[译]ASP.NET Core 2.0 视图引擎
查看>>
(原)InsightFace及其mxnet代码
查看>>
OpenCV学习:实现简单的图像叠加
查看>>
Intent跳转到系统应用中的拨号界面、联系人界面、短信界面及其他
查看>>
Linux内核OOM机制的详细分析(转)
查看>>
java.io包的总体框架图(转)
查看>>
MVC结构
查看>>
隐藏字
查看>>
js将long日期格式转换为标准日期格式
查看>>
Rafy 领域实体框架演示(4) - 使用本地文件型数据库 SQLCE 绿色部署
查看>>
2014第11周日
查看>>
MySQL 指定数据库字符集的 3 种方法。
查看>>
rabbitmq 介绍
查看>>