In this issue

Featured Contents


Featured Script

SQL Source Control Easy evaluation of database source control
The evaluation repository makes it easy to try SQL Source Control. Get started with the 28-day free trial.
SQL Storage Compress Compress live data by 73% 
Red Gate's SQL Storage Compress reduces the size of live SQL Server databases, saving you disk space and storage costs. Learn more.
SQL Compare Wish you had more contingency time?
Save hours deploying database schema changes with SQL Compare. "I could do the job by hand in hours, or use SQL Compare in seconds." Tim Kummer. Download SQL Compare now.

In This Issue

Stairway to Database Design Level 1: Data Elements

Before you start to think about your database schema or tables, you need to consider your data: the type of data it is, the scale you use for values. It needs to be unique, precise and unambiguous. Then you need to name it in such a way that it can be generally understood. Joe Celko explains... More »

SQL in the City - Austin 2012

A free day of training in Austin, TX with Grant Fritchey, Steve Jones and a few others. Join us to learn about SQL Server and how you can more efficiently work in your job every day. More »

Practical PowerShell for SQL Server Developers and DBAs – Part 1

There is a lot of confusion amongst DBAs about using PowerShell due to existence the deprecated SQLPS mini-shell of SSMS and the newer SQLPS module. In a two-part article and wallchart, Michael Sorens explains how to install it, what it is, and some of the excellent things it has to offer. More »

SQL Saturday #162 - Cambridge, UK

Come to Cambridge in the UK for a free day of training on SQL Server. Steve won't be there, but plenty of other Red Gate'ers will be. More »

Editorial - Ten Million Lines of Code

How many lines of code are in the applications you code on? I think that the largest applications I've been heavily involved in contained tens of thousands of lines of code. This was code that I actually had to search through to find a particular module to improve or refactor. I know lines of code aren't a great measurement of the value or complexity of an application, but they do represent an amount of overhead that you need to deal with. The more lines of code, the harder it can be to change, test, and deploy the application. 

Quickbooks, from Intuit, is a very popular program that exists on multiple platforms, localized in different regions, with a variety of editions and features, including a subscription version that gets new features as they are released. On the Windows platform, that system consists of 10mm lines of code in a single codebase, with different features turned on and off through a license key.

Ten million lines of code.

Wow, that's quite a branch of code. They manage that with a variety of techniques, one of which is fast becoming a requirement in technology. They use a continuous integration process that builds a new copy of the application every 15 minutes if any changes have been checked into their version control system. If there are any warnings or errors, all developers who checked in code are notified and they must track down the changes. The closer to development time a bug is found, the easier and cheaper it is to fix, so this is a great way to speed development.

They have a few other cool ideas, like building in parallel, and using separate builds for specific tools that handle different types of code analysis. However you look at it, this is quite a system for smoothing the software development lifecycle and managing a large, complex codebase. If you do corporate development, you might not have quite the same challenges, but I'm sure applying continuous integration, automated builds, and good source control habits can help you produce cleaner code, much faster than ever before.

» Join the debate, and respond to today's editorial on the forums

Advertisement: If you are looking to speed up your development process and reduce mistakes with Contiuous Integration, you might be interested in these white papers on automated deployment and CI for databases from Red Gate Software. It talks about how you can set up a process using various tools.

The Voice of the DBA Podcasts

We publish three versions of the podcast each day for you to enjoy.

Everyday Jones

The podcast feeds are available at Comments are definitely appreciated and wanted, and you can get feeds from there. Overall RSS Feed: or now on iTunes!

Today's podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music. Support this great duo at

You can also follow Steve Jones on Twitter:

» To submit an article, rant or editorial, log in to the Contribution Center

Question of the Day

Today's Question:

I have two Stored Procedures:

create proc sp_test1
 select col1, col2 
  from table1

create proc sp_test2
 select col1, col2 
  from table2

In the first Procedure table1 does not exist. In the second procedure table2 and col1 exist, but col2 does not exists. If I execute both scripts separately, what would be the result?

Think you know the answer? Click here, and find out if you are right.

This question is worth 1 point in this category: T-SQL. We keep track of your score to give you bragging rights against your peers.

We'd love to give you credit for your own question and answer. To submit a QOD, simply log in to Contribution Center.

SQL Server 2012 Query Performance Tuning

SQL Server 2012 Query Performance Tuning leads you through understanding the causes of poor performance, how to identify them, and how to fix them. You’ll learn to be proactive in establishing performance baselines using tools like Performance Monitor and Extended Events. You’ll learn to recognize bottlenecks and defuse them before the phone rings. You’ll learn some quick solutions too, but emphasis is on designing for performance and getting it right, and upon heading off trouble before it occurs. Delight your users. Silence that ringing phone. Put the principles and lessons from SQL Server 2012 Query Performance Tuning into practice today.

Get your copy from Amazon today.

Yesterday's Question of the Day

What is true about catalog views? (select 2 options)


  • Can inherit rows from other catalog views
  • Does not contaion information about SQL Server Agent

Explanation: Catalog views do not contain information about replication, backup, database maintenance plan, or SQL Server Agent catalog data. Information related to replication can be found in Replication Views. Dynamic management views/functions are used to monitor the health of a server instance, diagnose problems, and tune performance.


» Discuss this question and answer on the forums

Troubleshooting SQL Server: A Guide for the Accidental DBA

Three SQL Server MVPs provide fascinating insight into the most common SQL Server problems, why they occur, and how they can be diagnosed using tools such as Performance Monitor, Dynamic Management Views and server-side tracing. The focus is on practical solutions for removing root causes of these problems, rather than "papering over the cracks". Grab your copy today from Amazon.

Featured Script

SSRS Execution Log Queries

A few brief selects to expose snippets of data which may be useful for debugging larger issues. More »

Database Pros Who Need Your Help!

Here's a few of the new posts today on the forums. To see more, visit the forums.

SQL Server 2005 : Administering

Do I need to backup log if log shipping is implemented in that database ? - Hi, Do I need to backup log if log shipping is implemented in that database ? Will the log backup taken by...

xp_delete_file not deleting files on share drive - Hello, xp_delete_file not deleting files on share drive. is there any permission to be given?

SQL Server 2005 : SS2K5 Replication

add article to replication without snapshotting entire DB. - hi I simply want to add an article to an existing publication WITHOUT creating a new snapshot of the entire database,...

SQL Server 2008 : SQL Server 2008 - General

Cannot Add a Master Key to the Database - Hi, I'm very new to SQL Server, or databases, in general, so bare with me. I'm trying to create a...

Check room availability in hotel system - [font="Times New Roman"][/font] I'm a university student and I'm developing a database for a hotel system ,now I'm stack when I...

Can you recover SQL Authentication password? - All, If a user forgot his/her SQL Authentication password, is there anyway a DBA can recover that password, rather than resetting...

sql query prob - hi friends i have a small doubt in sql plz solve i have a table that table contains some nullt...

Filtering a database based on instr rules - Hi All, I have 2 database. The first database has 20 columns and 40000 rows. The first database looks like: Region|Deals US|8855 APAC|7988 7999 India|6855...

how to avoid sort transformations - Can anyone tell me :- "How to export Records from a table of a database to an excel file sorted based...

dead connection detection - In Oracle, one can set SQLNET.EXPIRE_TIME= <# of minutes> to have the server detect connections where the client has died (e.g....

SQL Beginner - I have a table in this format: Origin Destination Tonnage(Kton) Alabama Arizona 0.0012 Alabama Idaho 1.2 Idaho Alaska 644 Arizona Alaska 665 ......... Consisting of...

transaction cannot be committed - Dear Experts, What happen with my transaction below. I am getting this error. (Somehow I can't post the @ sign, in sql...

Derived column - i have column value something like below. {784A4579-8689-438E-ADAA-9DCBC8A88AE7} I just need "784A4579-8689-438E-ADAA-9DCBC8A88AE7" i.e value between {} can any one help me with this? thanks!!

Running a TSQL type job (not SSIS) through Proxy - I have an job which has SQL queries and Stored procedures. Can this step be run through an proxy account....

Why there is no SQLServer:BufferManager performance counter in windows performance monitor after installing sqlserver? - Hi all, there is one strange problem. I have installed the sqlserver 2008 R2 on one windows 2008 server system, but I...

SQL Server 2008 : T-SQL (SS2K8)

find a grouping with at least one row within the group containing a certain value - Hi all, How do you find a group where number of rows in the group are gtr than 1 and at...

Use Of TableValueConstructor - Hi, I am newbie. I was reading some very basic stuff about TVC. I had seen that in one example the...

UPDATE when the values are the same - Does an UPDATE query overwrite existing values if the already existing value is the same as the one your updating...

Hotel availability search - Hi I wanted to write a query to search a hotel between two dates These are the following tables 1.Hotel 2.Room 3.Allocation 4.Rate Following is the script...

SQL Server 2008 : SQL Server Newbies

Create view with no outer joins - Need to create view with no outer joins so I can index the view. Here is the query I use...

Checking Room availability in a hotel system! - [font="Times New Roman"][/font] I'm a university student and I'm developing a database for a hotel system ,now I'm stack when I...

use a variable to identify table in FROM statement - Dozens of our tables are set up where the table names are identical except for an ID number at the...

SQL query performance question - I am working on a small research team that has been given access to a set of SQL Server 2008...

SQL Server 2008 : SQL Server 2008 High Availability

Check room availability in hotel system - [font="Times New Roman"][/font] I'm a university student and I'm developing a database for a hotel system ,now I'm stack when I...

SQL Server 2008 : SQL Server 2008 Administration

what is CPU ? Physical or logical ? - When SQL Server runs on a computer with more than one microprocessor or CPU, it detects the best degree of...

Programming : Powershell

Get-WMIObject Win32_Volume fails on proxy account from Agent Job - It may just be a case of me missing something, but I get unexpected behaviour when running a job as... : Anything that is NOT about SQL!

Are the posted questions getting worse? - Is it me, or are the posted questions getting worse these days? I just read a post by someone apparently in...

Reporting Services : Reporting Services

Query execution failed for data set - Hello: Years ago, I composed SQL reports for a client and placed them on a tab in Business Portal 4.0 (SharePoint)....

Article Discussions by Author : Discuss Content Posted by Steve Jones

Checking Room availability in a hotel system! - [font="Times New Roman"][/font] I'm a university student and I'm developing a database for a hotel system ,now I'm stack when...