gpt4 book ai didi

tsql - 如何抑制 `DBCC SHRINKFILE` 的输出?

转载 作者:行者123 更新时间:2023-12-01 09:53:37 27 4
gpt4 key购买 nike

为了隐藏DBCC SHRINKFILE的输出我试过:

CREATE TABLE #Swallow(DbId int, Fileld int, CurrentSize int, MininumSize int, UsedPages int, EstimatedPages int)
INSERT INTO #Swallow EXEC('DBCC SHRINKFILE(''filename'', 0, TRUNCATEONLY)')

但它返回以下错误:

Cannot perform a shrinkfile operation inside a user transaction. Terminate the transaction and reissue the statement.



如何才能做到这一点?

最佳答案

似乎有一个 WITH NO_INFOMSGS选项:

DBCC SHRINKFILE('filename', 0, TRUNCATEONLY) WITH NO_INFOMSGS

引用: http://ss64.com/sql/dbcc_shrinkfile.html

关于tsql - 如何抑制 `DBCC SHRINKFILE` 的输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33081908/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com