There are many blogs covering this particular topic on internet but there are very few blogs available that actually will help when you are stuck with these 2 errors. I recently had a very tough time fixing these errors, hence Continue Reading..
Category: SQL Tricks
SQL Server Tips and Tricks
Simplest method to insert stored procedure output into a table – SQL Server
Recently in a developer meet, I was asked a question that, “is there a simpler way to have a stored procedure output fill into a table without defining all columns, as simple as like * into #t ?” You must be thinking about OPENQUERY, Continue Reading..
Pivot – Rows into columns in SQL Server using R
We have been using different methods in SQL to convert row data into columns. Some time it’s just the requirement for data visualisation only. To fulfil this requirement mostly we use PIVOT, which is complex and lengthy. In this blog Continue Reading..
Merry Christmas to the SQL family
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..
How to check if a column exists in a table – SQL Server
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
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..
Dynamic ORDER BY in SQL Server using CASE WHEN
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..
Capture TRUNCATE and DELETE events using Audit in SQL Server
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..
Get column names of a table in comma delimited format
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..
Convert columns into rows in SQL Server using VALUES and UNPIVOT
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..