What are the Properties of Sub-queries?

Properties: We can use Order by only when we use TOP Text, ntext and Image types are not supported in the select list of the sub query We can’t update a view created by using a sub query Distinct keyword can’t be

Read More

When do we use UDFs instead of Stored Procedures?

Since there are more advantages of Stored procedures over UDFs, most of us think that stored procedures are the best always. There should be some reasons why UDFs were introduced in DBMS. Below are the scenarios in which we should use UDFs

Read More

What are the types of Before Triggers available in SQL Server?

SQL Server does not support BEFORE triggers. We can use Instead of Triggers whenever we need Before triggers. Instead of Triggers execute instead of triggering the SQL statement. You can learn more about Instead of Triggers here. Happy Reading   

Read More

How do you generate the sequence of dates from one date to other?

This is possible through Recursive CTEs. You can execute the below code logic by passing @Start and @End variable values. DECLARE @Start datetime = ’02/08/2016′ DECLARE @End datetime = ’02/13/2016′ ;WITH Auto_Date AS (     SELECT @Start AS Dates_List    UNION ALL

Read More

How many Clustered Indexes we can create on a table? Why?

It is always only one. Clustered indexes sort and store the values in the physical order. Any table can have only one physical order but not more. Therefore, any table can have maximum of one clustered index always. Happy Reading   

Read More

What are the types of Stored Procedures available in SQL Server?

Types: User-defined Temporary Local Global System Extended user-defined Note: These types might change over the SQL Server versions changes. The above types are based on SQL Server 2016. Click here for the more information. Happy Reading   

Read More