In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article focuses on "how to compress data in SQLServer2008". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to compress data in SQLServer2008.
To enable database compression, simply add WITH (DATA_COMPRESSION=ROW) or WITH (DATA_COMPRESSION=PAGE) after the table statement is created. If you need to modify the existing index to enable compression, you can do so through ALTERINDEXindexONTableREBUILDWITH (DATA_C0MPRESSION=ROW) or ALTERINDEXindexONTableREBUILDWITH (DATA_C0MPRESSION=PAGE).
Finally, a simple script is provided to determine whether the data table needs to be compressed, and the compression script is automatically generated for the system administrator to execute. The unexposed stored procedure sp_MSforeachtable is used here. In this script, the @ precommand parameter is used to execute the SQL command before the execution of the command instruction, to establish a temporary table to store the information of the data table, the @ command1 parameter represents the SQL command to be executed, for each table, the sp_spaceused stored procedure is used to obtain the disk occupancy information of the table and save it in the established temporary table, and the @ postcommand parameter is used for the SQL command after executing the command instruction to associate the previously established temporary table with the system. Generate a data table compression script according to the set conditions (the data table occupies more than 10G of space).
How to compress data in SQLServer2008
Execsp_MSforeachtable@precommand=N'createtable## (idintidentity,namesysname,rowsint,reservedNvarchar (50), datavarchar (50), indexdatavarchar (50), unusedvarchar (50))', @ command1=N'insertinto## (name,rows,reserved,data,indexdata,unused) execsp_spaceused''''update##setdata=SUBSTRING (data,1,LEN (data)-2) whereid=scope_identity () AND
At this point, I believe you have a deeper understanding of "how to compress data in SQLServer2008". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
Kingdba1: first, RAC system structure design.
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.