I hope this script does not become infamous for the wrong reasons! Please use caution. I had to help a team recreate everything in a database and test their scripts but leave the roles and role grants in place. Basically, this meant that I could have scripted out the permissions and recreated the database but … Continue reading PowerShell: Drop All SQL Server Tables, Views, SP’s, Functions, Types etc.
There are a bunch of tools in the market to do the database comparisons for differences but if you want to do it for free (and programmatically) at a basic level, you could use the method outlined below. For me, this came about as a result of an user asking "So, what is different between … Continue reading SQL Server: Compare Database Tables/Indexes/Views/SP’s etc. For Differences Across Instances
Today I received a request from an application owner who wanted to know the size of all the CLOB and BLOB columns in all the non-system tables so that they have a good idea of the size involved for a migration. Tables with BLOB/CLOB columns The SQL to find the tables with the BLOB/CLOB columns … Continue reading Oracle: Find The Total Size Of All Of Your CLOB & BLOB Columns In All Tables
Update Sep 7, 2018: This article uses deprecated commands. Please checkout this blog post on "Alter Index Vs DBCC IndexDefrag Vs DBCC DBReIndex". In the newer versions, I prefer ALTER INDEX although it has not been good at defragmenting in all cases. A good defrag script is worth its weight in gold. This time, I copied … Continue reading SQL Server: Identify And Defragment Indexes Using DBCC SHOWCONTIG & DBCC INDEXDEFRAG
Requirement: Recently I got a request from a user that he wanted to copy a specific set of tables and their indexes into a new database to ship to the vendor for analysis. The problem was that the DB had thousands of tables (8,748 to be precise). Hunting and pecking for specific tables from that … Continue reading PowerShell – Copy SQL Server Tables – Structure, Data & Indexes To Another Database/Instance