What are the different types of locks?

SQL Server uses these resource lock modes. Lock mode Description Shared (S) Used for operations that do not change or update data (read-only operations), such as a SELECT statement. Update (U) Used on resources that can be updated. Prevents a common form of deadlock that occurs when multiple sessions are reading, locking, and potentially updating resources later. Exclusive (X) Used for data-modification operations, such as INSERT, UPDATE, or DELETE. Ensures that multiple updates cannot be made to the same resource at the same time. Intent Used to establish a lock hierarchy. The types of intent locks are: intent shared (IS), … Click here to continue reading.

What is referential integrity and how can we achieve it?

Referential integrity preserves the defined relationships between tables when records are entered or deleted. In SQL Server, referential integrity is based on relationships between foreign keys and primary keys or between foreign keys and unique keys. Referential integrity ensures that key values are consistent across tables. Such consistency requires that there be no references to nonexistent values and that if a key value changes, all references to it change consistently throughout the database. We can achieve this by using foreign key.

SQL Login Password Expiry Notification

Basically in SQL server DBA teams apply the password policies (i.e. enforce password policy & enforce password expiration) in sql login while creating new login for improve the security. But once password policy applied there are no options available in SSMS for getting the alert notification to DBA team about your created password will be expire on particular date before expire the login. There is a stored procedure which is select the list of sql or window authentication logins from master database which login created with password policy and check the expiry date of respective login. If any login will … Click here to continue reading.