SQL Server: Dynamically Calculate Delta Values For Numeric And Date Columns From DMV’s Or Any Table

DMV's are very useful. In fact, they are like glass windows that lets you look at a running engine. There are lots of them and they give us lots of numbers but Most are cumulative in nature!  i.e., the numbers keep on increasing and never decrease. A variation of above like space usage where the … Continue reading SQL Server: Dynamically Calculate Delta Values For Numeric And Date Columns From DMV’s Or Any Table

Advertisements

SQL Server – Dynamically PIVOT ANY Column On ANY Table in ANY Database For ANY Aggregation With ANY Condition

SOURCE CODE ATTRIBUTION: Before I proceed, I want to give credit to the original procedure by sfrejofsky based on which I created this procedure (mostly improvements). The source of this procedure is https://stackoverflow.com/questions/10404348/sql-server-dynamic-pivot-query I had a need to do dynamic PIVOTing for one of my projects and instead of reinventing the wheel, I used the … Continue reading SQL Server – Dynamically PIVOT ANY Column On ANY Table in ANY Database For ANY Aggregation With ANY Condition

SQL Server – Aliasing Tables In UPDATES For The Oracle Folks

If you transition from Oracle to SQL Server, something as simple as aliasing a table in an UPDATE statement might stump you (things that SQL Server developers take for granted) Here is what I mean: Create a temporary table (#Temp) to play with: Get the structure of #Temp This is also a trick to view the … Continue reading SQL Server – Aliasing Tables In UPDATES For The Oracle Folks

Oracle ROWNUM vs. SQL Server TOP – Differences & How To Do Pagination In Both

Sometimes we carry knowledge around that can hurt when doing similar things especially when dealing with the different programming languages and constructs. Today, let us see how Oracle’s ROWNUM is different from (as in, almost unrelated) SQL Server’s TOP. SQL Server - TOP: Basics Let us take the TOP function in SQL Server. It is … Continue reading Oracle ROWNUM vs. SQL Server TOP – Differences & How To Do Pagination In Both