Merry Christmas to all of you!! May Santa bring you all you’ve asked for and more.. This is my Christmas tree decorations. *Important: Press Ctrl + T and then execute the query. –*Important: Execute this query in Result to Text mode. Continue Reading..
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..
Last week a good friend of mine (Parth Shah) asked me a very interesting question that he wants to capture TRUNCATE and DELETE statements being fired on a database with very minimal overhead on the system. When performance is the Continue Reading..
I have seen many times that a few developers like to write SELECT * instead of column names. It’s definitely a bad habit and not the coding standard of-course. Few times I was reverted back saying that the table/view have very few Continue Reading..
Converting columns into rows in SQL Server is not a new thing, we often face this kind of scenarios. Lets say, there are values in different columns within a table and you want to perform some aggregations on those columns combining them all together or you 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..
I was working on a data warehouse project where the time data (HH:MM) were coming in decimal format from the source. Some of them were restricted to actual hour and minutes (23.59) and some were coming in real decimal format like (16.80). So I had Continue Reading..