Installing Updates from the Command Prompt

Applies to: SQL Server - Windows only

Test and modify installation scripts to meet the needs of your organization.

Sample Syntax for Installation

The name of the update package can vary and may include a language, edition, and processor component. Apply an update at a command prompt, replacing <package_name> with the name of your update package:

  • Update a single instance of SQL Server and all shared components, like Integration Services and Management Tools: You can specify the instance either by using the InstanceName parameter or the InstanceID parameter. To update a prepared instance of SQL Server, you must specify the InstanceID parameter.

    <package_name>.exe /qs /IAcceptSQLServerLicenseTerms /Action=Patch /InstanceName=MyInstance
    

    or

    <package_name>.exe /qs /IAcceptSQLServerLicenseTerms /Action=Patch /InstanceID=\<Instance ID>
    

    Beginning with SQL Server 2022 (16.x), read the Microsoft SQL Server Software License Terms at aka.ms/useterms.

  • Setup can integrate the latest product updates with the main product installation so that the main product and its applicable updates are installed at the same time. You can prepare an installation of database engine instance to include product update:

    setup.exe /q /IAcceptSQLServerLicenseTerms /ACTION=PrepareImage /UpdateEnabled=True /UpdateSource=\<path where the update is downloaded> /INSTANCEID=\<Instance ID> /FEATURES=SQLEngine
    
  • Update SQL Server shared components only, like Integration Services and Management Tools:

    <package_name>.exe /qs /IAcceptSQLServerLicenseTerms /Action=Patch
    
  • Update all instances of SQL Server on the computer and all shared components, like Integration Services and Management Tools:

    <package_name>.exe /qs /IAcceptSQLServerLicenseTerms /Action=Patch /AllInstances
    
  • Remove an update from a single instance of SQL Server and all shared components, like Integration Services and Management Tools:

    <package_name>.exe /qs /Action=RemovePatch /InstanceName=MyInstance
    
  • Remove an update from SQL Server shared components only, like Integration Services and Management Tools:

    <package_name>.exe /qs /Action=RemovePatch
    

    Note

    The update installer ensures that the shared components are always at or above the version of the instance at the highest level.

Supported parameters

Important

When possible, supply security credentials at run time. If you must store credentials in a script file, secure the file to prevent unauthorized access.

Switch Description
/? Displays unattended installation command prompt help
/action=Patch or /action=RemovePatch Specifies the installation action: Patch or RemovePatch.
/allinstances Applies the SQL Server update to all instances of SQL Server and to all SQL Server shared, instance-unaware components.
/instancename=InstanceName* Applies the SQL Server update to an instance of SQL Server named InstanceName, and to all SQL Server shared, instance-unaware components.
/InstanceID=Inst1 Applies the SQL Server update to an instance of SQL Server Inst1, and to all SQL Server shared, instance-unaware components.
/hideconsole Specifies that SQL Server the console window is hidden or closed.
/quiet Runs the SQL Server update Setup in unattended mode.
/qs Displays only the progress UI dialog.
/UpdateEnabled Specifies whether SQL Server setup should discover and include product updates. The valid values are True and False or 1 and 0. By default, SQL Server setup will include updates that are found.
/IAcceptSQLServerLicenseTerms Required only when the /Q or /QS parameter is specified for unattended installations.

*You cannot specify this parameter to apply an update to a prepared instance of SQL Server. You must specify the /instanceID parameter instead.

See also

Overview of SQL Server Servicing Installation