您的位置:首页 > 数据库

SQL Server 获取某时间点后修改的函数Function 并以文本格式显示

2013-07-12 17:10 603 查看
修改查询分析器如下选项

右键=》查询选项 =》结果=》文本=》 取消 在结果集中包括列标题 的勾选

右键=》将结果保存到=》 选择 以文本格式显示结果

执行如下SQL

declare @funcname nvarchar(100)=N'';
declare curFunc cursor for
select
[name]
--,create_date
--,modify_date
FROM
sys.all_objects
where
type_desc LIKE '%FUNCTION%'
and substring([name],1,3) not in ('dm_','fn_')
and modify_date >='2013-07-11 00:00:00'
order by
modify_date desc;

open curFunc;
fetch next from curFunc into @funcname;
while @@FETCH_STATUS = 0
begin
print(N'IF EXISTS(SELECT 1 FROM SYS.OBJECTS WHERE [NAME]=N''' + @funcname +''' AND [TYPE]=''FN'')')
PRINT(N'DROP FUNCTION ' + @funcname);
print N'GO';
exec ('sp_helptext ' + @funcname);
print N'GO';
fetch next from curFunc into @funcname;
end
close curFunc;
deallocate curFunc;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐