Archive

Archive for the ‘Database Administration’ Category

Recursive Queries – Leveraging CTE’s to work for you

September 20, 2012 3 comments

Playing around with Microsoft SQL Server 2008 Express edition, I’ve sorted through a bunch of tidbits. One that I thought was interesting, is how to perform a recursive or hierarchical query. This describes how you can perform the magic.

The official name of the WITH clause in Oracle’s lexicon (otherwise known as Oraclese) is a subquery factoring clause. Microsoft has a different name for the WITH clause. They call it a Common Table Expression or CTE. You can find more on that in this earlier blog post.

Read more…

Triggers – Save yourself the extra coding and time with automation

September 18, 2012 Leave a comment

Triggers are an often overlooked feature of SQL Server that can automate a LOT of tasks, such as auto-update an activity flag, or auto-insert new rows based on a new row in a different table. Instead of being required to code 100 lines of code to add a new row to a table and update all dependent tables, a trigger can be set to execute on an Update, Insert, or Delete (DML Trigger), Create, Alter, Drop, Grant, Deny, Revoke (DDL Trigger), or even upon login (Login Trigger).  Today, we’ll cover the three different types and how they can be used to automate your database tasks. Read more…

Basic Querying in SQL Server

September 11, 2012 Leave a comment

Today we’re going to talk about querying a database in SQL Server.  Queries can be really simple or nearly infinitely complex.  But that complexity can be deceiving, as it all breaks down to multiple combinations of the simple aspects of querying.  Today, we’ll discuss selecting items from a database and limiting those results to get results the way we want them.  You should have SQL Server 2008R2 and the AdventureWorks2008R2 database installed on your system.  If you don’t already, see the “Software”  link above. Read more…

Creating & Importing Databases – SQL Server 2008R2

September 6, 2012 Leave a comment

SQL Server is a Relational Database Management System (RDBMS), so being able to create and import databases is an essential function of all Database Administrators. Today, we’ll take a look at the different methods of creating and importing databases in SQL Server 2008 R2. There are multiple ways to create and import databases, including wizards, menu options, and coding. We’ll cover each in this lesson. Read more…