SQL Server Triggers To Mirror a Table

I had a need to mirror any changes to one Sql Server table to another Sql Server table of a different name.  Both tables had similar columns and types. In this sample my table is called Dave_Test and…

Read this article

SQL Server and Drop all Objects (Tables/Views/Stored Procedures etc.)

Sometimes you want to clear out a database, but you can't just drop the entire database and create a new one. Recently, a colleague needed to do just that, but couldn't because the database was hosted elsewhere. Here is a simple script that works to drop all objects in any database I've tested it against so far. If your database contains object types that mine don't, you might need to add to this script using the same patterns established here.…

Read this article

SQL COALESCE Command Features

In order to concatenate strings (delimited by with a string) from multiple rows in a SQL Table to a single field the Coalesce command is the one to use. Typically COALESCE is used to return a single field value which represents multiple rows concatenated by a string.…

Read this article

Export SQL Data to Microsoft Excel (using Visual Studio 2008, c#)

Over the years there have been a number of methods to move SQL data into Microsoft Excel. Using Automation you can call methods and properties that are specific to excel which gives you the greatest flexibility for specifying the location of your data in the workbook. The following are two recent approaches to export Sql Server table row data to an excel workbook.…

Read this article