UserName Property
The UserName property returns the Microsoft® SQL Server™ 2000 database user, determining privilege for the current connection.
Applies To
Database Object |
Syntax
object.UserName [= value]
Parts
object
Expression that evaluates to an object in the Applies To list
value
String that specifies an existing SQL Server database user by name
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 using SysFreeString.
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.