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.
Tag: Tables
SQL Server: Compare Database Tables/Indexes/Views/SP’s etc. For Differences Across Instances
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
Oracle: Find The Total Size Of All Of Your CLOB & BLOB Columns In All Tables
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
SQL Server: Identify And Defragment Indexes Using DBCC SHOWCONTIG & DBCC INDEXDEFRAG
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
PowerShell – Copy SQL Server Tables – Structure, Data & Indexes To Another Database/Instance
UPDATE Mar 25, 2021: I have created an updated version of the script with enhancements and sample usage that is available at my GitHub: https://github.com/SQLJana/PowerShell/blob/c6cbe1d5b4f97026d1b00df59403dcd1ed367065/Copy-SQLTable.ps1 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 … Continue reading PowerShell – Copy SQL Server Tables – Structure, Data & Indexes To Another Database/Instance