sql删除帮助需要请? [英] sql delete help need pls?

查看:93
本文介绍了sql删除帮助需要请?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助sql



i有tabel和i inser 100000+记录来测试应用程序的速度

和( .ldf)文件是52.3 MB

和我删除所有记录和(.ldf)文件仍然是52.3 MB可以有人给我建议如何释放文件??

解决方案

您好,



使用SHRINKFILE缩小数据文件大小。根据MSDN上的文档[ ^ ] SHRINKFILE

收缩大小当前数据库的指定数据或日志文件,或通过将数据从指定文件移动到同一文件组中的其他文件来清空文件,从而允许从数据库中删除该文件。您可以将文件缩小到小于创建时指定的大小。这会将最小文件大小重置为新值

语法为

 DBCC SHRINKFILE 

{file_name | file_id}
{ [,EMPTYFILE]
| [[,target_size] [,{NOTRUNCATE | TRUNCATEONLY}]]
}

[WITH NO_INFOMSGS]


基本上,你不能 - 删除记录不会减小文件的大小,空间只是为了将来的记录而发布。

你需要使用管理工作室收缩它: MSDN [ ^ ]

Hi i need help on sql

i have tabel and i inser 100000+ records to test the speed of aplication
and the (.ldf) file was 52.3 MB
and i delete all records and the (.ldf) file is still 52.3 MB can some one give me suggestion how to free the file??

解决方案

Hello,

Use SHRINKFILE to shrink the data file size. According to the documentation on MSDN[^] SHRINKFILE

Shrinks the size of the specified data or log file for the current database, or empties a file by moving the data from the specified file to other files in the same filegroup, allowing the file to be removed from the database. You can shrink a file to a size that is less than the size specified when it was created. This resets the minimum file size to the new value

The syntax is

DBCC SHRINKFILE 
(
    { file_name | file_id } 
    { [ , EMPTYFILE ] 
    | [ [ , target_size ] [ , { NOTRUNCATE | TRUNCATEONLY } ] ]
    }
)
[ WITH NO_INFOMSGS ]


Basically, you can''t - deleting records does not reduce the size of the file, the space is just released for future records.
You need to use the management studio to Shrink it: MSDN[^]


这篇关于sql删除帮助需要请?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆