While working on ETL, I build a list of tables and their corresponding columns that need to be created on the destination server. In this case the square brackets around SchemaName and TableName are mandatory. I started adding the square brackets with the built-in function QUOTENAME(), but soon I got […]
While working on autocomplete dropdown, i created a simple scalar function that replaces multiple spaces with one.
We usually mask the credit card number in reports or end user data with asterisk (*). Here I show a scalar-valued function that masks the Credit Card Number.
I built a function for reporting purposes that shows the duration in hh:mm:ss between two datetime columns. It can be used in a reporting tool to show the data in a log. The max difference in DATEDIFF() is 68 years. Quick and extended calculation (every year is a leap year): 68 years […]
An user-defined function to convert comma separated values (CSV) to an Array (table) is always needed. I wrote one that uses a multi-character delimiter and returns not/trimmed values. The string searches for the delimiter, inserts the left slice into the resulting table and cuts the left slice from the string. […]