The Login object exposes the attributes of a single SQL Server Authentication record.
Microsoft® SQL Server™ uses two ways to validate connections to SQL Server databases: Windows NT Authentication and SQL Server Authentication. SQL Server Authentication uses login records to validate the connection. A Login object exposes a SQL Server login record.
With a Login object, you can:
Note To view, create, or remove SQL Server logins by using the Login object, the connected user must be a member of the SQL Server securityadmin fixed server role.
The Name property of a Login object uses the SQL Server data type sysname. The value of the Name property must be unique for a server running SQL Server.
A SQL Server login is created with no password and no rights to any database on the server. After successful creation of a SQL Server login, you can use the SetPassword method of the Login object to assign a password to the login. Use the Database User object and Users collection to grant login access to server resources.
To add a login to a server running SQL Server
EnumDatabaseMappings Method | Remove Method (Objects) |
GetUserName Method | Script Method |
IsMember Method | SetPassword Method |
ListMembers Method (Login, User) |
Database Property | Name Property |
DenyNTLogin Property | SystemObject Property |
Language Property | Type Property (Login) |
LanguageAlias Property |