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

posted on 2007-04-17 18:57
gamebaby 阅读(80)
评论(0) 编辑 收藏