DatabaseFile.Shrink Method (Int32, ShrinkMethod)

 

Applies To: SQL Server 2016 Preview

Shrinks a database file.

Namespace:   Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

Syntax

public void Shrink(
    int newSizeInMB,
    ShrinkMethod shrinkType
)
public:
void Shrink(
    int newSizeInMB,
    ShrinkMethod shrinkType
)
member Shrink : 
        newSizeInMB:int *
        shrinkType:ShrinkMethod -> unit
Public Sub Shrink (
    newSizeInMB As Integer,
    shrinkType As ShrinkMethod
)

Parameters

  • newSizeInMB
    Type: System.Int32

    An Int32 value that specifies the new size of the database file.

Examples

Legacy Code Example

Using Filegroups and Files to Store Data

See Also

DatabaseFile Class
Microsoft.SqlServer.Management.Smo Namespace

Unable to find linked topic '39e00ebe-c9b7-4d53-90bd-15de2015fd34'.

Return to top