When i Execute the Below Query it doesn't show me whether the guest account is enabled or disabled.
SELECT name, type_desc, is_disabled
FROM sys.server_principals
When i Execute the Below Query it doesn't show me whether the guest account is enabled or disabled.
SELECT name, type_desc, is_disabled
FROM sys.server_principals
YOU CAN TRY SOMETHING LIKE THIS:
SELECT U.UID, U.STATUS, U.NAME, U.SID, P.TYPE, P.TYPE_DESC, P.IS_DISABLED, P.NAME, P.PRINCIPAL_ID FROM SYSUSERS U LEFT OUTER JOIN SYS.SERVER_PRINCIPALS P ON U.[name] = P.[name]
The guest user is actually per database so it would be listed in sys.database_principals (sys.server_principals is for server level security and logins).
The rights are contained in each databases sys.database_permissions. To connect to a database, you need CONNECT rights assigned:
CREATE USER foo FROM ...
GRANT CONNECT TO foo
So, what rows are there is sys.database_permissions for guest?