DROP LOGIN : LOGIN « User Role « SQL Server / T-SQL Tutorial






69> SELECT name, hasaccess, isntname, isntgroup, isntuser, sysadmin
70> FROM sys.syslogins
71> WHERE LEFT(name, 4) <> '##MS'
72> GO
name                                                                                                                             hasaccess   isntname    isntgroup   isntuser    sysadmin
-------------------------------------------------------------------------------------------------------------------------------- ----------- ----------- ----------- ----------- -----------
sa                                                                                                                                         1           0           0           0           1
BUILTIN\Administrators                                                                                                                     1           1           1           0           1
NT AUTHORITY\SYSTEM                                                                                                                        1           1           0           1           1
J\SQLServer2005MSSQLUser$J$SQLEXPRESS                                                                                                      1           1           1           0           1
BUILTIN\Users                                                                                                                              1           1           1           0           0

(5 rows affected)
1>
2> IF EXISTS(SELECT * FROM sys.syslogins
3>     WHERE name = N'computername\winlogin1')
4>     DROP LOGIN [computername\winlogin1]
5> GO
1>
2> CREATE LOGIN [computername\winlogin1] FROM WINDOWS
3> GO
Msg 15401, Level 16, State 1, Server J\SQLEXPRESS, Line 2
Windows NT user or group 'computername\winlogin1' not found. Check the name again.
1>
2> SELECT name, hasaccess, isntname, isntgroup, isntuser, sysadmin
3> FROM sys.syslogins
4> WHERE LEFT(name, 4) <> '##MS'
5> GO
name                                                                                                                             hasaccess   isntname    isntgroup   isntuser    sysadmin
-------------------------------------------------------------------------------------------------------------------------------- ----------- ----------- ----------- ----------- -----------
sa                                                                                                                                         1           0           0           0           1
BUILTIN\Administrators                                                                                                                     1           1           1           0           1
NT AUTHORITY\SYSTEM                                                                                                                        1           1           0           1           1
J\SQLServer2005MSSQLUser$J$SQLEXPRESS                                                                                                      1           1           1           0           1
BUILTIN\Users                                                                                                                              1           1           1           0           0

(5 rows affected)
1>








28.7.LOGIN
28.7.1.Creating a SQL Server Login
28.7.2.Viewing SQL Server Logins
28.7.3.Creating a Windows Login
28.7.4.Viewing Windows Logins
28.7.5.Altering a Windows Login
28.7.6.Dropping a Windows Login
28.7.7.Denying SQL Server Access to a Windows User or Group
28.7.8.Creates a new Windows login and then maps that login to a new database user
28.7.9.Create a proxy login from the certificate
28.7.10.Create a proxy user and grant access to the schema
28.7.11.DROP LOGIN
28.7.12.Altering a SQL Server Login
28.7.13.Dropping a SQL Login