In this issue

Featured Contents


Featured Script

SQL Monitor SQL Monitor v3 is even more powerful
Use custom metrics to monitor and alert on data that's most important for your environment, easily imported from our custom metrics site. Find out more.
SQL Source Control Connect your existing source control system to SQL Server
SSMS plug-in connects SVN, TFS, Git, Hg and all others to SQL Server. No source control system needed to evaluate. Learn more.
SQL Backup Are you sure you can restore your backups?
Run full restore + DBCC CHECKDB quickly and easily with SQL Backup Pro's new automated verification. Check for corruption and prepare for when disaster strikes. Try it now.

In This Issue

Stairway to XML: Level 5 - The XML exist() and nodes() Methods

The XML exist() method is used, often in a WHERE clause, to check the existence of an element within an XML document or fragment. The nodes() method lets you shred an XML instance and return the information as relational data.  More »

SQL in the City - Seattle 2012

Start the week in Seattle off with a free day of training on Nov 5, 2012 with SQL in the City. Grant Fritchey, Steve Jones and more will be talking SQL Server in the Pacific Northwest. Join us and debate and discuss SQL Server the Red Gate Way. More »

SQLServerCentral Webinar Series #21 - Forgotten Rings & Other Monitoring Stories

Most common monitoring metrics are important and useful, especially over time, but they can fall short. How do you gather information to determine, for example, if you have buffer cache pressure? Register now for the free webinar. Wednesday, October 17 2012 4:00pm - 5:00pm BST More »

From the SQLServerCentral Blogs - Microsoft Security Bulletin MS12-070 for SSRS

Today is black Tuesday for October 2012. One security bulletin is specifically for a component of the SQL Server stack:... More »

Editorial - Questioning the Interviewer

When you are in a job interview, it's almost inevitable that near the end the interviewer will ask you what questions you have. As noted in this post, a large number of people have no questions. It's certainly possible that the interview covered all the questions you would want to have answered, but do you have a list of questions before the interview starts?

You should. I think it's important that you ask questions in an interview, especially questions that are important to you. Many times each of us wants a job, needs to get a job, and don't want to do anything that might jeopardize our chances. However taking a job that's a bad fit, or has some aspect that will bother you every day is a bad idea. You spend a lot of time at work and a poor work environment can make your life miserable.

In the piece, the person makes a good point that your questions reflect your priorities and can result in an unfavorable impression. I think you can ask about topics like telecommuting, but do so in a way that shows you are interested and excited about the job. I've noted long commutes and the time they take in an interview, asking if I can better use that time to solve problems by working at home a day or two. The way you bring topics up can matter, so make sure that you word your questions in a way that shows you are interested in doing a good job.

I do think that asking questions which show your enthusiasm or interest in the position are good questions to ask. However you should think about those questions before you go to the interview and determine if what impression they make. Write down your questions, and if they are answered during the interview, mark them off and ask any remaining questions at the end. 

The interview is your best chance to determine if the position is a good fit for you and the company, so take advantage of that.

Steve Jones

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:

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

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

Question of the Day

Today's Question:

I Set the options to support indexed views.


I then execute the following T-SQL statement

CREATE VIEW dbo.c_view
 SELECT [CustomerID]
      , [FirstName]
      , [LastName]
      , [Priority]
      , [CreateDate]
  FROM [dbo].[Customer]

The view is created. I then execute the following T-SQL statement

CREATE STATISTICS CV_Stats ON Dbo.C_view (LastName)

The question is: are the Statistics created ?

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

This question is worth 1 point in this category: Views. 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.

Professional SQL Server 2012 Adminstration

Microsoft SQL Server 2012 will have major changes throughout the SQL Server and will impact how DBAs administer the database. With this book, a team of well-known SQL Server experts introduces the many new features of the most recent version of SQL Server and deciphers how these changes will affect the methods that administrators have been using for years. Loaded with unique tips, tricks, and workarounds for handling the most difficult SQL Server admin issues, this how-to guide deciphers topics such as performance tuning, backup and recovery, scaling and replication, clustering, and security.

Get your copy from Amazon today.

Yesterday's Question of the Day

Look at this T-SQL.

begin try

Declare @ctr int
Declare @a float
Declare @b int

select @ctr = 1
select @a = 10
select @b = .001

while @ctr <= 10
  if @ctr = 4
   select @a/@b
  select @ctr = @ctr+1
end try
begin catch
 select @ctr
end catch

select @ctr 'Counter'
What is the final value of the Counter?

Answer: 4

Explanation: The data type of the variable @b is int and hence the value of @b will be '0' though assigned with .001 and a divide by zero error encountered which therefore will be catched and the counter will be 4.

» Discuss this question and answer on the forums

 Inside the SQL Server Query Optimizer

This book will take you from the fundamentals of Statistics, Cost Estimation, Index Selection, and the Execution Engine, and guide you through the inner workings of the Query Optimization process, and throws in a pragmatic look at Parameterization and Hints along the way. Grab your copy today from Amazon!

Featured Script

Finding Dynamic SQL's Dependencies

The script finds dependencies of Dynamic SQL based on a table containing T-SQL Queries, DB's and Linked Servers in which it can be executed. 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

Log shipping hybrid - Within a few months we hope to be using Netapp's Snap Manager for Sql Server to "replicate" changes in our...

data folder permission - Hi, By default installation, SQLServer2005MSSQLuser$<INSTANCENAME>$MSSQLSERVER is having the below access to SQL Server Data folder. Full Control Modify Read and Execute List Folder Contents Read Write Auditor...

CPU 100%, current queries show "CREATE PROCEDURE ... " - Hi, I have a SQL Server 2005, which works fine and on some time it starts to use 100% of CPU....

SQL Server 2005 : Backups

backup background process - when backup is taken can anyone tell me as to what exactly happens in the background

SQL Server 2005 : T-SQL (SS2K5)

first official day of every month for past 3 years - i have a table and a column with dates. there are multiple dates for same date . these dates are inserted...

SQL Server 7,2000 : Administration

Finding out Total Disk Space in TSQL - anyone know any workaround in TSQL who can give this result set? [b] Drive letter | Total Disk Space (MB) | Free Disk Space...

SQL Server 2008 : SQL Server 2008 - General

newbie help pls - Customer CustomerID CustomerName Birthdate 1 John Doe 1/1/1970 08:31 AM 2 Jane Doe 1/1/1971 01:18 PM 3 Jon Public 1/1/1972 11:58 PM 4 Jane Public 1/1/1973 07:00 AM 5 John Smith 1/1/1974 08:31 AM Order OrderID PO Number OrderDate 1000 ABC123 1/1/2012 01:00...

Arithmetic overflow error converting nvarchar to data type numeric. - hello when i run the following sql query: "update table set price = price * 1.1 " i get the following error : "Msg 8115, Level...

How to select the inherited values in hierarchical data structure is efficient way - I have hierarchical data structure with [State] as top level, [Region] as intermediate level and [Branch] as leaf level. Region can...

How do I join tables, but select top 1 from 1-many tbl? - Essentially I have a Contact table and a History table. I'd like to get the join the tables, but only show...

UCT to WST -15min - Hi, So I need to write a query that will if something was modified in the last 15 min. The...

help with difficult situation - I am working on a project where i need to identify records from a "sales_log" table where the person who...

Help with SQL Query - Hi, I have a table which looks like : Name Region City Status N_Region N_City N_Status E_Region E_City E_Stauts Peter AMERICA NY A...

XML + SOAP - Can you guys help me with this XML? [code="sql"] if object_id('tempdb.dbo.#Temp') is not null drop table dbo.#Temp CREATE TABLE #Temp (col xml) INSERT #Temp (col) select...

SQL Server 2008 : T-SQL (SS2K8)

Using CTE doughts - Hello comunity I have build this current CTE query to have a drilldown information to know from the customer order, which...

Prioritize the records in a table - I have a table which has id and statement columns, statement column contains statement like insert into tablename, update tablename,...

Avg count of cases per day - Hello everyone. I am looking to produce a result set from a helpdesk application that tells me the average number...

Determine unique combinations of permissions assigned to users - I need to determine the unique combinations of group permissions assigned to users. Currently, permissions are assigned to a user....

T SQL Help - Comma separated numric value - SELECT YEAR(OrderDate) AS OrderYear, SUM(CASE WHEN DATENAME(Q,OrderDate) =1 THEN TotalDue END)AS Q1, SUM(CASE WHEN DATENAME(Q,OrderDate) =2 THEN TotalDue END)AS Q2, SUM(CASE WHEN DATENAME(Q,OrderDate) =3...

select rows where values appear consecutively - Ok, I have a question. I need to select data from a table where a specific value appears for a...

SQL Server 2008 : SQL Server Newbies

User - select from master database query. - Hi, I need to access the master table to checkl the applications logged into the database for a licensing issue. If...

I can't get Modify (Maintenance Plans) to do anything. - In SSMS, when I highlight a maintenance plan that I successfully created, right click, and then select Modify, nothing happens....

Comparing multiple versions of a field - I am working with healthcare data. In some cases, a claim may have 3 different versions (based on whether the...

Trying to view properties of the Database - When I right click on the database to view properties on any of the databases on the server I get...

SQL Server 2008 : SQL Server 2008 High Availability

Configure DB Mirroring on 2 SQL Servers on different SPs - I have 1 server with SQL Server 2008 R2 SP1 and another SQL Server on SQL 2008 R2 SP2. I have...

SQL Server 2008 : SQL Server 2008 Administration

Checkpoint - Log Backups - Hello All I've been doing some research and testing on the topic of the Checkpoint process I understand that the job of...

Shrink of data file - DBCC SHRINKFILE - taking a long time and not completing - stuck at 99% completion - We had a large data purge recently where a large part of the data in a file was deleted. File is...

configuring log shipping from 2008 to 2005 - can we configure below logshipping setup Prmiary: SQL Server 2008 Secondary Server 2005 with Standby Mode would it work? can any one suggest... : Anything that is NOT about SQL!

Today's Random Word! - HI When you woke up today, or logged-onto Opera Forums, you may have had a dream, a thought, a scene...

Reporting Services : Reporting Services

Reportin services - AVG of avg - Hello, I have question, how to sum rows. I create query =avg(iif(filds!urgency.value=1 and filds!_time<=14,1,iif(filds!urgency.value=2 and filds!_time<=130,1,0)), everything is ok, but I...

Database Design : Design Ideas and Questions

Normalization from an excel form - Hey guys, I have some problems with normalizing the data. Could you take a look at this file These is the list...

Data Warehousing : Integration Services

Generate XML using SSIS - Can someboy tell me is it possible to generate XML using SSIS script task and SSIS variables (not from SQL...