Checking a column existence in a table is very simple in SQL Server, but you should be careful while doing it on Azure environment. We simply ignore the performance consideration while writing SELECTs against systems tables/views/dmvs etc. Recently a stored proc started Continue Reading..
How to generate Fibonacci Series in SQL Server? This is a very commonly asked interview question for SQL developers. I assume you must be knowing what is Fibonacci Series? In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Continue Reading..
Few times I have observed that developers directly consider the dynamic SQL option as a solution, when there is need to sort the result set on basis of user input variables/parameters. Let’s see how can we do the sorting using case when. Continue Reading..
Personally I am very strict to the datatypes, whether it’s for a column or parameter or just a variable. I don’t like if somebody choose them carelessly. Always the datatypes needs to used precisely. Make it as a coding standard or your Continue Reading..
I recently had a requirement to round off a decimal value to 0.5 either higher side or lower side. Example: 1.4 the higher side round off should be 1.5 and lower side should be 1 same way 2.7 should round off to Continue Reading..
There would be situations where in an application would have developed ages ago not considering to support multi time zone but later you realise and want to handle the same, when the application is already on production for couple of months or years. Recently I had Continue Reading..
A friend of mine asked me a very interesting question today, she wanted date output like “14th Mar 2016”. Immediately I answered her to use new FORMAT function eg: FORMAT (GETDATE(), ‘dd MMM yyyy’) or CONVERT(VARCHAR(10), GETDATE(), 13) which returns Continue Reading..
You must be wondering what is this correlated join in SQL Server? Let me clarify it’s not a type of join like INNER or OUTER, it is a kind of usage or play around with joins. Some call it derived join too. Anyway it Continue Reading..
A friend of mine asked me a very interesting question today that how to delete cross duplicate rows from a table? He had basically two columns named ID1 and ID2 in a table, there he had to find the cross Continue Reading..
What is the difference between temp table and global temp table and table variable and CTE in SQL Server ? It is a very commonly asked interview question and you must know the differences between them to use the appropriate method while writing SQL Continue Reading..