Share via


LocalDBStopInstance Function

Stops the specified SQL Server Express LocalDB instance from running.

Header file: sqlncli.h

Syntax

HRESULT LocalDBStopInstance(
           PCWSTR pInstanceName,
           DWORD dwFlags, 
           ULONG ulTimeout 
);

Parameters

  • pInstanceName
    [Input] The name of the LocalDB instance to stop.

  • dwFlags
    [Input] One or a combination of the flag values specifying the way to stop the instance.

    Available flags:

    • LOCALDB_SHUTDOWN_KILL_PROCESS
      Shut down immediately using the kill process operating system command.

    • LOCALDB_SHUTDOWN_WITH_NOWAIT
      Shut down using the WITH NOWAIT option Transact-SQL command.

    If none of the flags is set, the LocalDB instance will be shut down using the SHUTDOWN Transact-SQL command. If both flags are set, the LOCALDB_SHUTDOWN_KILL_PROCESS flag takes precedence.

  • ulTimeout
    [Input] The time in seconds to wait for this operation to complete. If this value is 0, this function will return immediately without waiting for the LocalDB instance to stop.

Returns

Remarks

For a code sample that uses LocalDB API, see SQL Server Express LocalDB Reference.

See Also

Concepts

SQL Server Express LocalDB Header and Version Information