--- title: "LocalDBShareInstance Function | Microsoft Docs" ms.custom: "" ms.date: "03/06/2017" ms.prod: sql ms.prod_service: "database-engine" ms.reviewer: "" ms.technology: ms.topic: "reference" apiname: - "LocalDBShareInstance" apilocation: - "sqluserinstance.dll" apitype: "DLLExport" ms.assetid: 21eb3b9a-7d32-455b-89bb-f624198cd202 author: "CarlRabeler" ms.author: "carlrab" --- # LocalDBShareInstance Function [!INCLUDE[appliesto-ss-xxxx-xxxx-xxx-md](../../includes/appliesto-ss-xxxx-xxxx-xxx-md.md)] Shares the specified SQL Server Express LocalDB instance with other users of the computer, using the specified shared name. **Header file:** sqlncli.h ## Syntax ``` HRESULT LocalDBShareInstance( PSID pOwnerSID, PCWSTR pInstancePrivateName, PCWSTR pInstanceSharedName, DWORD dwFlags ); ``` ## Parameters *pOwnerSID* [Input] The SID of the instance owner. *pInstancePrivateName* [Input] The private name for the LocalDB instance to share. *pInstanceSharedName* [Input] The shared name for the LocalDB instance to share. *dwFlags* [Input] Reserved for future use. Currently should be set to 0. ## Returns S_OK The function succeeded. [LOCALDB_ERROR_NOT_INSTALLED](../../relational-databases/express-localdb-error-messages/localdb-error-not-installed.md) SQL Server Express LocalDB is not installed on the computer. [LOCALDB_ERROR_INVALID_PARAMETER](../../relational-databases/express-localdb-error-messages/localdb-error-invalid-parameter.md) One or more specified input parameters are invalid. [LOCALDB_ERROR_INVALID_INSTANCE_NAME](../../relational-databases/express-localdb-error-messages/localdb-error-invalid-instance-name.md) The specified instance name is invalid. [LOCALDB_ERROR_UNKNOWN_INSTANCE](../../relational-databases/express-localdb-error-messages/localdb-error-unknown-instance.md) The specified instance does not exist. [LOCALDB_ERROR_ADMIN_RIGHTS_REQUIRED](../../relational-databases/express-localdb-error-messages/localdb-error-admin-rights-required.md) Administrator privileges are required in order to execute this operation. [LOCALDB_ERROR_SHARED_NAME_TAKEN](../../relational-databases/express-localdb-error-messages/localdb-error-shared-name-taken.md) The specified shared name is already taken. [LOCALDB_ERROR_INSTANCE_ALREADY_SHARED](../../relational-databases/express-localdb-error-messages/localdb-error-instance-already-shared.md) The specified instance is already shared. [LOCALDB_ERROR_INTERNAL_ERROR](../../relational-databases/express-localdb-error-messages/localdb-error-internal-error.md) An unexpected error occurred. See the event log for details. ## Remarks For a code sample that uses LocalDB API, see [SQL Server Express LocalDB Reference](../../relational-databases/sql-server-express-localdb-reference.md). ## See Also [SQL Server Express LocalDB Header and Version Information](../../relational-databases/express-localdb-instance-apis/sql-server-express-localdb-header-and-version-information.md)