The User object exposes the attributes of a single Microsoft® SQL Server™ database user.
A database user is a security principal enabling object access permission control at the finest level of granularity. A user represents a single SQL Server login within the scope of the database in which the user is defined.
With the User object, you can:
The Name property of a User object is a character string. Name must be a valid string for the SQL Server sysname data type and cannot include a backslash character (\).
When creating a database user by using the User object, setting the Name property is optional. When the Name property is not set, a user is created having the same name as the value specified by using the Login property.
To create a database user
A database user cannot be removed if the user owns objects in the database. With SQL-DMO, use the Owner property to reassign database object ownership.
To remove a database user
IsMember Method | ListOwnedObjects Method |
ListDatabasePermissions Method | Remove Method (Objects) |
ListMembers Method (Login, User) | Script Method |
ListObjectPermissions Method |
ID Property | Role Property |
Login Property | SystemObject Property |
Name Property |