共用方式為


UserProfile Property

未來的 Microsoft SQL Server 版本將移除這項功能。請避免在新的開發工作中使用這項功能,並規劃修改目前使用這項功能的應用程式。

The UserProfile property returns a high-level role description for the Microsoft SQL Server login or database user used by the current connection.

語法

object
.UserProfile

Parts

  • object
    An expression that evaluates to an object in the Applies To list.

Data Type

Long, enumerated

Modifiable

Read-only

Prototype (C/C++)

For the Database object:

HRESULT GetUserProfile(SQLDMO_DBUSERPROFILE_TYPE* pRetVal)

For the SQLServer object:

HRESULT GetUserProfile(SQLDMO_SRVUSERPROFILE_TYPE* pRetVal)

Returns

For the Database object, interpret the UserProfile property using these SQLDMO_DBUSERPROFILE_TYPE values.

Constant

Value

Description

SQLDMODbUserProf_/AllProfileBits

1023

The user has all specifiable database maintenance permissions.

SQLDMODbUserProf_/CreateDefault

32

The user has permission to execute the CREATE DEFAULT statement.

SQLDMODbUserProf_/CreateFunction

512

The user has permission to execute the CREATE FUNCTION statement.

SQLDMODbUserProf_/CreateProcedure

8

The user has permission to execute the CREATE PROCEDURE statement.

SQLDMODbUserProf_/CreateRule

128

The user has permission to execute the CREATE RULE statement.

SQLDMODbUserProf_/CreateTable

2

The user has permission to execute the CREATE TABLE statement.

SQLDMODbUserProf_/CreateView

4

The user has permission to execute the CREATE VIEW statement.

SQLDMODbUserProf_/DbNotAvailable

-1073741824

User permissions could not be determined due to offline or other error.

SQLDMODbUserProf_/DboLogin

1

The user is a member of the db_owner role.

SQLDMODbUserProf_/DumpDatabase

16

The user has permission to back up data for the referenced database.

SQLDMODbUserProf_/DumpTable

256

The user can back up database data, specifying a table as the backup unit.

SQLDMODbUserProf_/DumpTransaction

64

The user can back up the transaction log of the referenced database.

SQLDMODbUserProf_/InaccessibleDb

-2147483648

The referenced database is offline or is otherwise inaccessible.

SQLDMODbUserProf_/InvalidLogin

1073741824

The current connection login has no user permissions in the referenced database.

SQLDMODbUserProf_None

0

The user has no database modification or maintenance permissions.

For the SQLServer object, interpret the UserProfile property using these values.

Constant

Value

Description

SQLDMOSrvUserProf_/AllProfileBits

7

The login has all specifiable SQL Server maintenance permissions.

SQLDMOSrvUserProf_/CreateDatabase

2

The login has CREATE DATABASE permission.

SQLDMOSrvUserProf_/CreateXP

4

The login can execute sp_addextendedproc and sp_dropextendedproc (loading and unloading extended stored procedures).

SQLDMOSrvUserProf_None

0

The login has no SQL Server maintenance permission.

SQLDMOSrvUserProf_/SaLogin

1

The login is a member of the sysadmin role.

備註

Fixed server and database roles allow greater granularity in specifying maintenance of an instance of SQL Server. For more information, see DatabaseRole Object and ServerRole Object.