Monthly Archives: December 2012

T-SQL: Generate SQL Script to Shrink Transaction Logs of All Databases

Here’s a quick and dirty way of generating the T-SQL script to shrink the transaction log of each database on your SQL Server instance:   EXEC sp_msForEachDB ‘PRINT ” USE ? GO ALTER DATABASE ? SET RECOVERY SIMPLE GO DBCC … Continue reading

Posted in T-SQL | Leave a comment

VSDBCMD: Create a .dbschema File from an Existing Database

If you have a Visual Studio Database project and want to reference an existing database, you can generate a .dbschema file from the command line. Here’s an example: [cc] vsdbcmd /a:Import /cs:”Server=(local);Database=MyDatabase;Trusted_Connection=True;” /dsp:SQL /ModelFile:MyDatabase.dbschema [/cc] Hope this helps!

Posted in MS SQL Server, Visual Studio | Leave a comment

log4net: A Custom Subject SmtpPickupDirAppender With Emails Containing All Referenced Assemblies

The more information you have in your error notification emails the better. Here’s a way you can get all the referenced assemblies into a log4net generated email that has a custom subject line. First, in your application start-up, add the … Continue reading

Posted in C#, log4net | Leave a comment

HowTo: Execute a SQL Agent Job via a Stored Procedure

Here’s a way your application can kick off a long running SQL process that is wrapped up in a SQL Agent Job. Running a job via a stored procedure this way would allow your application not to block for the … Continue reading

Posted in MS SQL Server, T-SQL | Leave a comment

IT Toolbox: TechNet Magazine December 2012

The December IT Toolbox column is up on the TechNet Magazine website. In December, I covered these products: HTTPie: Easily test Web services LogMeister: Centralized log file monitoring Check it out and let me know what you think! And, as … Continue reading

Posted in Microsoft TechNet | Leave a comment