How long since you ran DBCC CHECKDB?
If you’re not regularly looking for corrupt databases with DBCC CHECKDB, you’re putting your organization’s data at risk. I run DBCC CHECKDB once per day, or as is reasonably possible. Typically, DBCC CHECKDB is setup…
Index reorg/rebuild script
Index fragmentation may be causing more I/O than necessary for efficient query processing. Fragmentation occurs as a result of inserting items into the middle of the index instead of appending them to the end. Inserting…
Capturing Index Usage Stats
Overview Index usage stats are invaluable for evaluating performance of existing indexes. Every time an index is used by the query-engine, an internal table is updated reflecting that usage. So, every time a scan, seek,…
Hidden tables in SSMS: detect and create them!
Did you know hidden tables may be lurking in your database? SQL Server Management Studio is a world-class database management toolset, and includes some really great features. Arguably the most-used feature is the Object Explorer…
Modify device path for multiple Backup Devices
Backup Devices provide a nice way to permanently configure the backup location, enabling BACKUP DATABASE to look like:
|
1 |
BACKUP DATABASE [xyz] TO [backup-device-name]; |
When you create a Backup Device, you specify the physical location where backups will actually be…
Common data-type conversions between SQL Server, Oracle, Sybase ASE, and DB2.
SQL Server includes a little-known, but handy, function that can show you common data-type conversions for a target system; useful for ETL between disparate systems. Run this code:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
DECLARE @source_dbms sysname = N'%' , @source_version sysname = N'%' , @source_type sysname = N'%' , @destination_dbms sysname = N'%' , @destination_version sysname = N'%' , @destination_type sysname = N'%' , @defaults_only bit = 0; SELECT * FROM sys.fn_helpdatatypemap ( @source_dbms , @source_version , @source_type , @destination_dbms , @destination_version , @destination_type , @defaults_only ); |
The above code returns a result-set…