Using Dynamic SQL to Create Database Objects

Say we have a stored procedure that we want to copy across multiple databases. One way would be to create the script and execute in all the databases. But if Databases are many it can be time consuming and efforts to change Database name every time before executing the script will be more. One better way is writing a script that can create the Database object in selected Databases or all Databases at once.
[More]

Query Plan for highest Usecounts

Performance is something every Developer struggles with at some point or other. In order to do optimization we can see query plan. This article will demonstrate as how we can create the function that will show us the query plan and how we can use it to see plans of objects that are highly used

[More]

Tags: , , , , , , , ,

SQL Server | SQL Tricks

APPLY Operator

Apply operator is of two types: Cross Apply and outer apply. Cross Apply is more like left outer join and Outer apply is more like outer join. [More]

Table Valued Parameters

Table Valued Parameters are new to SQL Server 2008. They allow us to pass table variable to stored procedure. The same function can be accomplished by temporary tables, but table valued provide better performance and complete dataset in a table can be passed to stored procedure. [More]

Scalar Function ISEmpty in SQL Server

When we are working with data exchange from flat files or excel files to our relational tables, sometimes, empty records get inserted instead. Since, in SQL Server null and empty records are different, and if we need to have a scalar function that can be used to replace empty records then it can be done as below. [More]

Tags: , ,

SQL Server | SQL Tricks | Scalar Function