惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
B
Blog RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
V
V2EX
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Engineering at Meta
Engineering at Meta
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
M
MIT News - Artificial intelligence
IT之家
IT之家
博客园 - 【当耐特】
U
Unit 42
云风的 BLOG
云风的 BLOG
L
LangChain Blog
小众软件
小众软件
Microsoft Security Blog
Microsoft Security Blog
B
Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
宝玉的分享
宝玉的分享
N
Netflix TechBlog - Medium

博客园 - gamebaby

去掉rhel 6的缺少授权证书提示 c++消息 脚踏实地向前走 读xml内容 - gamebaby - 博客园 InvokeMember Invoke 项目经理应该知道的. 获取表信息 Email(VB.net) - gamebaby - 博客园 Email(C#) - gamebaby - 博客园 主外键 转义符 常规触发器 创建数据库 触发器 CASE 语句 事务处理 游标例子2(转载) 游标例子1(转载)
Clear Sqlserver log
gamebaby · 2007-04-17 · via 博客园 - gamebaby

print ''
if Exists( Select * From sysObjects where name='spClearLog' )
Drop Proc spClearLog
go


Create Proc spClearLog(@sDataBase sysname)

  With Encryption
As
Begin
  Declare @Sql           nvarchar(1000)
  Declare @LogLogicName  nchar(128)

  Set @Sql='Select @insLogLogicName=Name From '+@sDataBase+'.dbo.sysfiles Where GroupID=0'
  Exec sp_ExecuteSql @Sql,
                     N'@insLogLogicName nchar(128) output',
                     @LogLogicName  output

  Set @Sql='
             Backup log '+@sDataBase+' with no_log
             Use '+@sDataBase+'
             Dbcc ShrinkFile('+@LogLogicName+',1)
           '
  Exec sp_ExecuteSql @Sql
 

End

Go