Month: October 2014

Quick way to Reindex all tables on SQL Server Database

USE NMPortal GO EXEC sp_MSforeachtable @command1=”print ‘?’ DBCC DBREINDEX (‘?’, ‘ ‘, 80)” GO EXEC sp_updatestats GO

Rename SQL Server Database

Rename SQL Server Database: Change the Database to Single User Mode and Rollback all the existing Transactions. This is done because you need to obtain Exclusive Database Lock. That way you don’t encounter errors related to obtaining database lock. Rename

Import Excel Into SQL Server

Copied from here. http://blogs.technet.com/b/sqlthoughts/archive/2008/10/03/out-sql-powershell-function-export-pipeline-to-a-new-sql-server-table.aspx http://tools.perceptus.ca/text-wiz.php http://dnhlmssql.blogspot.com/2013/05/from-excel-to-insert-into-another.html ############################################################################## ## ## out-sql.ps1 ## ## by Alexey Yeltsov, Microsoft Corp. ## Raju Venkataraman Added some fixes for Table creation and Inserts ## Export pipeline contents into a new SQL table ## ## Parameters:

Top