declare @data varchar(20)
select @data= '数据库名'
execute ('execute sp_helpdb ' + @data )
execute (' BACKUP LOG ' + @data + ' WITH TRUNCATE_ONLY ' )
execute (' DBCC SHRINKDATABASE( ' + @data + ',10)')
execute ('execute sp_helpdb ' + @data )
文章来源:http://bbs.winos.cn/viewthread.php?tid=5999&extra=page%3D1%26amp%3Bfilter%3Dtype%26amp%3Btypeid%3D22