UserName Property (SQL-DMO)

The UserName property returns the Microsoft® SQL Server™ database user, determining privilege for the current connection.

Applies To

Database Object

Syntax

object.UserName [= value]

Part Description
object Expression that evaluates to an object in the Applies To list
value String specifying an existing SQL Server database user by name

Remarks

Members of the sysadmin fixed server role or db_owner fixed database role can set the UserName property to impersonate the database user specified. For more information, see SETUSER.

Data Type

String

Modifiable

Read/write

Prototype (C/C++)

HRESULT GetUserName(SQLDMO_LPBSTR pRetVal);

HRESULT SetUserName(SQLDMO_LPCSTR NewValue);


Note SQL-DMO strings are always returned as OLE BSTR objects. A C/C++ application obtains a reference to the string. The application must release the reference by using SysFreeString.


  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.