Scalar function for calculating date

Suppose we want to keep handy a function that will calculate and give date going backward or forward any number of days from current date. So say, we want to get a date for 100 days prior to current date we can keep this function handy. [More]

Tags: , , , , ,

Scalar Function | SQL Server | SQL Tricks

IsZero Scalar Function

In situations where we want to replace zero with some other value, e.g. if division involves some computation that bring zero as a result, then it will result in divide by zero error. For such scenarios we can have IsZero function to replace zero with some other numeric value.
[More]

Tags: , , ,

Scalar Function | SQL Server | SQL Tricks

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