Category Archives: SQL server

Shrink Transaction Logs in all every database SQL Server

SQL Server transaction logs need backed up regularly, or they will grow and grow forever, eventually filling up all available disk space. That is best done in a maintenance plan. Unfortunately you have to remember to set that up post … Continue reading

Posted in SQL server | Leave a comment

Remote Desktop Connection Manager

Remote Desktop Connection Manager, a free download from http://www.microsoft.com/en-gb/download/details.aspx?id=21101, lets you switch quickly between windows servers, saves the servers and your login details in a list.

Posted in SQL server, Windows | Leave a comment

SQL Server recently changed objects

List recently changed procedures and views in a database: SELECT name , create_date , modify_date FROM sys.objects WHERE ( create_date >= DATEADD ( DAY , -7 , GETDATE() ) OR modify_date >= DATEADD ( DAY , -7 , GETDATE() ) … Continue reading

Posted in SQL server | Leave a comment

Shrink msdb database SQL Server

Steps to shrink msdb database in SQL Server 2005: T-SQL: truncate table msdb.dbo.log_shipping_monitor_history_detail T-SQL: exec msdb.dbo.sp_purge_jobhistory @oldest_date='2013-02-07T13:55:10'(change date above as required) T-SQL: alter index all on msdb.dbo.sysjobhistory reorganize Management Studio: system databases > msdb > tasks > shrink > databaseOR, … Continue reading

Posted in SQL server | Leave a comment

Study notes crib sheet for exams 70-457 70-458 70-459 MCSE SQL Server 2012

Here is the crib sheet/study notes I used for the three exams: 70-457 Transition your MCTS on SQL Server 2008 to MCSA: SQL Server 2012 – Part 1 70-458 Transition your MCTS on SQL Server 2008 to MCSA: SQL Server … Continue reading

Posted in SQL server | 3 Comments

Indexed views – workaround for “Cannot create index on view because it uses a LEFT, RIGHT, or FULL OUTER join, and no OUTER joins are allowed in indexed views. Consider using an INNER join instead.”

Indexed views (the SQL Server equivalent of Oracle’s materialized views) are a good performance fix, especially for reporting and data warehouse systems. However they only work with inner joins. Attempts to create an indexed view with outer joins fail with: … Continue reading

Posted in Performance tuning, SQL server | Leave a comment

Windows Server 2008 R2 Firewall for SQL Server and FTP

Windows Server 2008 R2 has a strict firewall by default. It will not let you run FTP (client) from the server and get files from other servers/sites It will also not let you run “SQL Server Management Studio” from your … Continue reading

Posted in Installs, SQL server, Windows | 2 Comments

Howto remove carriage return line feed from SQL Server for displaying in Excel

Use this SQL to remove carriage return line feed from SQL server for displaying in excel: select REPLACE(column_name, CHAR(13) + CHAR(10), ‘, ‘) from table_name ; Based on posts by Aaron Bertrand and David Seruyang.

Posted in Character sets, SQL server | 4 Comments

Quick SQL Server Training for Oracle DBAs

Short SQL Server Training course uploaded in MS-Word format.. Also same in pdf format. It’s a bit dated now – is for SQL Server version 7.0 – but still relevant. I’ll update for version 2005 and convert to html format … Continue reading

Posted in SQL server | 3 Comments

SQL Server 2005

SQL Server 2005 doesn’t prompt during install for locations of datafiles and logfiles, meaning they will end up on C:, which you won’t normally want. You can alter the locations during install, but it’s not especially intuitive. Or at least … Continue reading

Posted in SQL server | 1 Comment