Category Archives: SQL Server 2011 (Denali)
Script to check – Login Name and Password are same
It is always a risk if the user name & password is equal. You can run the below script to find out the list of User/Login name & password which are equal.
select cast(@@SERVERNAME as varchar(150)) as SQLInstanceName ,name as [LoginName] ,'Password is same as Login Name' [Description] from sys.syslogins WHERE PWDCOMPARE (name,password) = 1
Steps to add Log Shipping monitor into an existing SQL Server
Problem
I have a requirement to add the Log Shipping Monitor for an existing installation. I have heard you can only complete this by rebuilding the Log Shipping infrastructure. Is that true? Are there any other options? In this tip I will explain how we can add the Log Shipping monitor to a SQL Server 2005, 2008, 2008 R2 or 2012 environment without rebuilding the Log Shipping installation.
sys.sql_logins
sys.sql_logins: Returns one row for each SQL Server authentication login. It will return all the below columns.
- name
- principal_id
- sid
- type
- type_desc
- is_disabled
- create_date
- modify_date
- default_database_name
- default_language_name
- credential_id
- is_policy_checked
- is_expiration_checked
- password_hash
You can query sys.sql_logins to get all the below information.
SQL Logins which are disabled:
SELECT name FROM [sys].[sql_logins] WHERE [is_disabled] = 1;
SQL Server Logins which adhere the password policy:
SELECT name FROM [sys].[sql_logins] WHERE [is_policy_checked] = 1;
SQL Server Logins which do not adhere to the password policy
SELECT name FROM [sys].[sql_logins] WHERE [is_policy_checked] = 0;
SQL Logins which do not adhere to password expiration
SELECT name FROM [sys].[sql_logins] WHERE [is_policy_checked] = 0 OR ([is_policy_checked] = 1 AND [is_expiration_checked] = 0);
Prevent Truncation of Dynamically Generated Results in SQL Server Management Studio
Problem
While working with the Results to Text option in SSMS, you may come across a situation where the output from dynamically generated data is truncated. In this article I will guide you on how to fix this issue and print all the text for the Results to Text option.
