How to set database size limit on MSSQL Server? Print

  • 0

Please refer to the following steps to set the database size limit for Microsoft SQL Server.

Using SQL Management Studio

  1. Login to your SQL Management Studio.

  2. Right-click on the database for which you want to set the limit and click on properties.

  3. At the database properties dialogue box, click on the files.

  4. Here, you will find a button called Autogrowth / maxsize. Click on it.

  5. It will open a dialogue box with the name change Autogrowth for the database.
  6. Tick on Enable Auto Growth option. Inside Maximum File Size, check the radio button and set the maximum size you want to set for the same database.

Using SQL Query

  1. Connect to your Database Engine and click on the New Query.

  2. Run the below query and change your database and database file name.

    USE master;
    GO
    ALTER DATABASE your_db_name
    MODIFY FILE
        (NAME = db_file_name,
        SIZE = 50MB);
    GO
  3. You can run the below query to find the file name of your database.

    USE MyDataBase
    SELECT name
    FROM sys.database_files
    WHERE type_desc = ‘ROWS’;
    GO

Was this answer helpful?

« Back

chat