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

Varchar vs NVarchar

So let’s talk about this to better understand some differences and benefits of using each of these data types. NVarchar – the ‘N’ in varchar means uNicode.  The column can store any Unicode data.  The…

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

List Indexes in SQL Server

The following SQL will list all indexes in within the database that you run the sql script.  I was looking for the option within Visual Studio - Data Dude add-on that displayed index differences between two databases.  I eventually discovered the line by line index comparison by exploding the Table-Indexes <strong>however</strong> I was unable to create the newly added script index in the 2nd database.…

Read this article