|
|
-
|
|
At times, we might need to search a string in TSQL using LIKE operator for a special character (%,_,[,]). These special characters do have different meaning in normal string comparisons so we need to escape them for making them to be a part of search patte...
|
|
-
|
|
In some cases we tend to write ‘SELECT * …’ in our queries. Even though we have code maintenance issues with ‘SELECT * …’ query (say for example in case a new column gets in to the schema, application coding against this query breaks), most important issue...
|
|
-
|
|
Today there was an interesting conversation between me and a young SQL Developer on how we can get a custom order of a resultset in TSQL. We spoke about different combinations starting from Table Variables, Temp Tables till Sub-queries. I am not able to ag...
|
|
-
|
|
There are majorly 4 different ranking functions in SQL Server. They are –
ROW_NUMBER()
RANK()
DENSE_RANK()
NTILE(INT)
They all are different and in my own terminology they can be used to define row versions in programmatic point of view. I mea...
|
|
-
|
|
Check out the following sample code to understand the basic differences between ISNULL and COALESCE functions in SQL Server. Code is self explanatory and comments are provided for ease of understanding.
/****************************************************...
|
|
-
|
|
Imagine you have a table Employee with no identity column, and by mistake you got a ETL package executed twice and landed up duplicate information twice. So now its time for you to clean up duplicate data. There are many ways to do the same, say with curso...
|
|
-
|
|
Dirty Reads and Phantom Reads are the concurrency problems which one can land up in case transactions are not planned correctly. Dirty reads results when a particular select statement retrieve data which is still uncommitted, in this case data can be chang...
|
|
-
|
|
Transaction Isolation levels in SQL Server controls how locks are will be placed on data while running different concurrent sessions of queries. This concept is very important, as it directly influences how and what data will be returned and saved on diffe...
|
|
-
|
|
PIVOT rotates a table-valued expression by turning the unique values from one column in the expression into multiple columns in the output, and performs aggregations where they are required on any remaining column values that are wanted in the final output...
|
|
-
|
|
Most of the times it would be tricky on how to catch exceptions of different types such as business errors, data sanitation errors and logical errors etc. In this small tutorial I am planning to show how to capture different types of errors and log them in...
|
|