SQL Server/T-SQL Tutorial/System Tables Views/sys.syslogins — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 10:24, 26 мая 2010
Query sys.syslogins
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>