Upgrading Older Databases

A new version of SQL Server is released every few years. This year was no different with the launch of SQL Server 2012 in March. It is important to migrate older, unsupported databases to a current version. I am going to examine 3 different techniques to upgrade the [PUBS] sample database from SQL Server 2000 to 2008 R2. The first two techniques require the database files to be copied from the older server to the new one. Use the ALTER DATABASE command to kick off the users and set the…

Various Triggers – Part 5

Another usage of Database Triggers is track Data Definition Language (DDL) changes that occur in a database. Today, I am going to enhance the AUTOS database script to add such auditing. This auditing is a very good practice when multiple people have syadmin rights to make such changes. First, I am going to create a schema called Audit Database Tracking (ADT) to seperate the data tables from audit tracking tables.

Second, I am going to create a table to hold the keep track of the DDL changes that are…

Various Triggers – Part 4

Another usage of Data Modification Language (DML) triggers is the replicating data for historical tracking or data aggregation. Today, I am going to expand on the AUTOS database that I created in prior articles to demonstrate such usage. The business unit has asked us to track each macro task in the making of an automobile.   To accomplish this goal, I am going to add the following objects to the AUTOS database. STATUS_CODE – a coded version of the status of a given task. MAKE_STATUS – for a given vehicle…

Just Say No!

Most security administrators are eager beavers when it comes to deploying and running antivirus software on any computer they can get their hands on. This includes Microsoft Windows Servers running your SQL Server Database engine. Do not let security administrators scan your database files and make your 2012 Dell xeon with eight cores perform like a 1996 Gateway Pentium 4 single core. I have seen the results of antivirus software scanning the database files while I am trying to execute basic queries. It is extremely painful.   With that said.…

RunAs SSMS VB Script

A seperation of power between a day-to-day user account and a special occasion adminstrator account can be beneficial for a DBA. By usig a less privledge account for daily activities can avoid costly human mistakes. A mistake will be denied due to not having the correct privledges. It is standard to use Microsoft Windows Domain Accounts for daily adhoc queries. A Standard SQL Account is usually used by custom applications to connect and perform work in the database. How does one easily switch from one windows account to another? A…

Various Triggers – Part 3

A typical use of Data Modification Language (DML) triggers is to prevent unwanted data modification. AFTER triggers are great at detecting the INSERT, UPDATE or DELETE action and rolling back the changes. A good security model can prevent these types of changes and should be the first line of defense. However, there are cases in which keys to the castle have to be given out for political reasons inside the organization. In that case, this type of preventive programming can be handy. Today, I am going to revisit the AUTOS…