FIX: TEXT/IMAGE Data Storage Space Not Reclaimed Correctly

This article was previously published under Q272220
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 57959 (SQLBUG_70)
If you delete text or image data, space may not be reused when new data is inserted. This can lead to the sp_spaceused stored procedure showing unused space within a table, but an attempt to insert new data will either cause the relevant files to grow or fail with errors of type 1105:
Could not allocate space for object '%.*ls' in database '%.*ls' because the '%.*ls' filegroup is full.
When space is required for text or image data outside of the pages maintained by the current Page Free Space (PFS) page, that space is allocated by searching for a full free extent, to optimize for speed. This leaves partially used extents with space that will not be reused unless those extents become completely free.

For further information about PFS pages and allocation, see SQL Server Books Online.
To defragment the text or image data and recover the unavailable unused space, use the bulk copy program (BCP) to bulk copy the data out of the table and then back into the table so that the storage will then be contiguous.
Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 3 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
274799 INF: How to Obtain Service Pack 3 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
For more information, contact your primary support provider.
With the fix installed, the allocation will start using free pages within existing extents when no more free extents can be allocated. This will only happen when the files within the relevant filegroup are unable to grow. Text or image data can be stored to a specified filegroup using the TEXTIMAGE_ON clause of the CREATE TABLE statement in order to place text or image data separately and reserve space for other data.

Alternatively, with the fix installed, you can use trace flag 1180 to force allocation to use free pages for text or image data and maintain efficiency of storage; however, this may impact performance.
data type datatype

Article ID: 272220 - Last Review: 10/21/2013 00:53:47 - Revision: 2.1

Microsoft SQL Server 7.0 Standard Edition

  • kbnosurvey kbarchive kbbug kbfix kbqfe KB272220