In this issue

Featured Contents


Featured Script

Better train people and risk they leave - than do nothing and risk they stay.

Red Gate Deployment Manager NEW! Never waste another weekend deploying
Deploy SQL Server changes and ASP .NET applications fast, frequently, and without fuss, using Deployment Manager, the new tool from Red Gate. Try it now.
SQL Backup Disaster Recovery is made quick and easy with SQL Backup Pro
Use SQL Backup Pro's restore wizards and scripts to get your database back online as quickly as possible following a disaster scenario. Download a free trial today.
SQL Developer Bundle 12 essential tools for database professionals
The SQL Developer Bundle contains 12 tools designed with the SQL Server developer and DBA in mind. Try it now.

In This Issue

Tip: Resetting Identity Fields

How to reset an identity field to the next contiguous value, after deletions. More »

SQL Saturday #172 - Washington, D.C.

A free day of training in the US nation's capital. Come join in if you are nearby. More »

How to Identify and Backup the Latest SQL Server Database in a Series

I have to support a third party application that periodically creates a new database on the fly. This obviously causes issues with our backup mechanisms. The databases have a particular pattern for naming, so I can identify the set of databases, however, I need to make sure I'm always backing up the newest one. Read this tip to ensure you are backing up your latest database in a series. More »

Editorial - Grow Your Skills

The cloud is scary. Without a doubt the idea of outsourcing parts of your organization's technology department should concern you if you manage systems. Anything outsourced, whether to another firm or automation, means there is less work for you to do. Even in the places where automation grows, we find that sometimes the growth of systems occurs so fast that there are still things for a worker to do, but that's a losing battle in the long term. At some point the automation will catch up and less people will be needed to manage the systems.

However the news isn't all bad. There are some systems that will always be managed inside of a company. Whether because of regulatory requirements, performance needs, or even just the stubbornness of management, I am sure that some percentage of systems at most companies will remain in-house. Those will be the minority of systems in some places, and since many of us change jobs at some point in our careers, we should be concerned. 

I would argue that all of us working in technology should be looking to improve our skills in whatever field we work. However we should be growing the skills in the hard parts of our jobs, in the parts that we struggle to automate or describe. The easy parts of our jobs will become more automated, more likely to be managed by a tool or outsourced. The hard parts, the thoughtful parts, those are the skills we should concentrate on when improving our skills.

Outsourcing isn't all bad. As Toyota has outsourced some of their systems, they are not looking to shrink their IT department. Instead they are focusing on delivering new products and services for their customers. Make sure you are prepared to take advantage of new opportunities if your company follows a similar path.

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

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:

This question and answer have been validated for SQL Server versions 2008 and 2008 R2 (and may be correct for other releases too). If x is a char(1) variable, how many values can it take for which

@x LIKE '[aeiou]' collate Latin1_General_ci_ai AND NOT
  ( @x like 'A' collate Latin1_General_ci_ai  OR
    @x like 'E' collate Latin1_General_ci_ai  OR
    @x like 'I' collate Latin1_General_ci_ai  OR
    @x like 'O' collate Latin1_General_ci_ai  OR
    @x like 'U' collate Latin1_General_ci_ai

is true?

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

This question is worth 2 points 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 T-SQL Recipes: A Problem-Solution Approach

SQL Server 2012 T-SQL Recipes is an example-based guide to the Transact-SQL language that is at the core of SQL Server 2012. It provides ready-to-implement solutions to common programming and database administration tasks. Learn to create databases, insert and update data, generate reports, secure your data, and more. Tasks and their solutions are broken down into a problem/solution format that is quick and easy to read so that you can get the job done fast when the pressure is on. Get your copy from Amazon today.

Yesterday's Question of the Day

Once referential integrity is enforced, which of the following statements are not correct? (choose 2)


  • Can delete a row from primary table if there are related rows in secondary table
  • Can insert a new row in secondary table if there are not related rows in primary table

Explanation: We can't delete rows from the primary table if the secondary table contains referential rows. We also can't insert a new row in the secondary table without primary references.

Ref :

» Discuss this question and answer on the forums

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.

Featured Script

Get space used by queries in tempdb

See what is taking up space in tempdb. 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 : SQL Server 2005 General Discussion

SQL transaction and lock of the table for SELECT - Hi to all I am very new in SQL Server world. I was working with Oracle more of 10 years. Now...

Export table data to UTF-8 text file problem - Running: Microsoft SQL Server 2005 - 9.00.3152.00 Enterprise Edition SP2 Enterprise Edition (Intel IA-64) I need to export data from a table...

SQL Server 2005 : SQL Server 2005 Integration Services

for each loop files in folder starting with @[User::strFileNameStart] + "*.csv" - I have an folder with multiple files . For passing the folder, i have set the Directory expression as @[User::strFinSourceFolder] + "\\" I...

Pass SQL Execute task output to target tbl(Data flow). - Hi, we need to insert random values to target table. We are using the query in SQL Execute task with single row...

SQL Server 2005 : SQL Server Newbies

Using Dense Rank - CREATE TABLE [REV_BINDERS]( [OFFICE_ID] [int] NOT NULL, [BINDER_ID] [int] NOT NULL, [BINDER_NO] [varchar](7) NULL, ) INSERT INTO [REV_BINDERS] ([OFFICE_ID],[BINDER_ID],[BINDER_NO]) select 2105110,10,0101 union all select 2105110,12,0102 union all select...

SQL Server 2008 : SQL Server 2008 - General

A problem with using full text search with wildcard query - Hi, I have a weird case with the full text search in Sql Server 2008 R2 SP1 web edition. I have a...

sql query implementaion - hi friend i have a small doubt in sql server plz tell me how to solve table data contins like...

Running SSIS packages - I have 15 packages in dev server , at first instance we need to execute 7 and next 8 in the...

locking in DML statement - Hi what is the difference between IX and X lock on a table?(Totally I plus s,x,u,etc.) according to what i have read,'I'...

Alternative to xp_cmdshell - i need to delete some backup files as per daily operation through SQL ,currently i am using xp_cmdshell ,is there...

Mirroring Endpoint Port Number - Dear, I want to configure database mirroring with automatic failover option. That is why I want to make my PC as...

How to Know server is in SRDF - We have SRDF DR setup in our SQL env and one common question which arise everyday is how can one...

Replace a substring using Powershell - Hi, I've got a job, one step of which adds some articles into a publication: [code="sql"]$DBScriptFile = "C:\Scripts\RO_replication.sql" #SCRIPT Invoke-Sqlcmd -ServerInstance localhost -database master...

TSQL Problem: Week between 2 different months - Hello, I have a script problem. I calculate data per week (group by week) However, for indicators, I have business rules which apply...

SQL Server 2008 : T-SQL (SS2K8)

Thousand Seperator Magic - All, I have recently faced the below scenario. i.e to add comma as the thousand seperator I have searched here and found the...

Calculate weekend - Hi, I have a scenario in which i need to create a function which takes 2 parameter (count,startdate). If I have...

Help On Execution Plan Status - Hi All, I am a newbie in SQL Server and like exploring it. Currently i was working with some complex queries...

Query Help - I've a table like below: [code="sql"]CREATE TABLE #Emp ( Emp char(6), UplineEmp char(6), Lvl tinyint) ; insert #Emp ([Emp], [UplineEmp], Lvl) values ('209156' ,'003033'...

Recursion with a Twist - Hi - can't seem to get my head around this one, so any assistance is welcome. I am trying to write...

SQL Server 2008 : SQL Server Newbies

Problem With AdventureWorks - Hello: I am new to this forum and would like some help with SQL Server 2008 R2 Express. I downloaded SQL...

SQL Server 2008 : SQL Server 2008 High Availability

SQL server 2008r2 instlation - hi i tried to install sql server 2008r2 in mixed mode any one help on this.

SQL Server 2008 : SQL Server 2008 Administration

SCOM on SQL Server 2008 SP1 - Hi All, How can I know id SCOM is installed on my server or not. If yes, is there a place...

Data Warehousing : Integration Services

How do I remove Attunity 2.0 from my development machine - Okay - I'm running a dev instance on Windows 7 - which when I build, I added attunity 1.2, and then attunity...

Data Warehousing : Analysis Services

Numeric Dimension Attribute in SSAS 2008 R2 - Good evening to all. I use SSAS 2008 R2 and i did some cubes. I built a dimension PRODUCT that contains 2...

Microsoft Access : Microsoft Access

QR Code-Integration of Microsoft Access and Microsoft Word - What is the easiest way to integrate Microsoft Access and Microsoft Word? We are converting permit numbers to QR code. 00000...