In this issue

Featured Contents


Featured Script

SQL Backup Hosted Quick, easy off site SQL Server backups
Back up to the cloud quickly and easily using SQL Backup Pro’s GUI. Get cheap, scalable storage for your SQL Server backups. Find out more.
SQL Compare Compare and sync databases with SQL Compare
“SQL Compare is fast, extremely easy to use, full-featured and affordable. I wouldn't bother messing around with anything else.” Adam Machanic, SQL Server MVP. Download a 14-day free trial.
SQL Monitor Check SQL Server performance at a glance
We consulted 1000 SQL Server professionals to make SQL Monitor’s UI as clear as possible. Start monitoring with a free trial.

In This Issue

PowerShell vs GUI Availability Group Rebuild

Windows Cluster\SQL Availability Group rebuild times comparison - Management Studio & Cluster Manager Vs PowerShell Commands  More »

Getting Started with the SSAS Tabular Model

SSAS Tabular models are in-memory databases that model data with relational constructs such as tables and relationships, in order to provide a rapid and powerful way of providing self-service BI to client applications such as Microsoft Excel and Microsoft Power View. You’ve deployed SSAS in tabular mode, and deployed Adventureworks into it. What next? Rob Sheldon explains all. More »

SQL Saturday #229 - Dublin

SQL Saturday Dublin is hosting a two-day training event covering SQL Server 2012, Business Intelligence, Database Administration and Personal Development. The free training event will be Saturday June 22 2013, and three preconference sessions (not free) will take place the 21st. More »

From the SQLServerCentral Blogs - Printing the Report Parameters on SSRS

  I'm surprised there isn't an option in the Report Manager for allowing you to include on the print out of... More »

Editorial - Losing Data

Most of us that work as data professionals hate the idea of losing data. When the developer calls and says his test database is gone and backups were never set up, we may shrug our shoulders and offer to help next time, but we feel bad. We will try everything we can do to recover the data, usually going out of our way to give it our best effort. 

We will lose data. There will be situations that are out of our control, and we have to accept that. However we should try not to make the easy mistakes ourselves that might cause data loss. I ran across a short piece on Five Sure Ways to Lose Data and I agree with the items, but I think there are a few more things we should watch out for.

One of the easiest mistakes to make to forget is to set up backups. Too often we implement new databases under time pressure, dealing with software that is dropped in our laps at the last minute. Security permissions are never documented and during the frustration of just getting something deployed, we may forget to set up a backup system, intending to do it next week.

Don't do that. Get backups set up immediately. It's quick, it's easy, and you should have some automated process or script ready. As soon as you complete backups, invite yourself to a meeting to set up monitoring in the next day or two. That's one of the other easy things to fix: ensuring your backup schemes are working by monitoring your servers. Your monitoring should include alerts for DBCC checks and high severity errors in addition to backups at a minimum. Automating this, or using a tool, are the best things you can do.

There are lots of other things we might ignore that can cause data loss, but if you get your backups working, you should be able to recover from most any situation.

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

Voice of the DBA Podcasts

The podcasts will return tomorrow.

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

Question of the Day

Today's Question:

You have a table named Product with three columns: ProductID, Name and Color. Which of the following queries runs successfully based on this information? (select 3)

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 Data Integration Recipes

SQL Server 2012 Data Integration Recipes provides focused and practical solutions to real world problems of data integration. Need to import data into SQL Server from an outside source? Need to export data and send it to another system? SQL Server 2012 Data Integration Recipes has your back. You'll find solutions for importing from Microsoft Office data stores such as Excel and Access, from text files such as CSV files, from XML, from other database brands such as Oracle and MySQL, and even from other SQL Server databases. You'll learn techniques for managing metadata, transforming data to meet the needs of the target system, handling exceptions and errors, and much more.

Get your copy from Amazon today.

Yesterday's Question of the Day

What will be the output of the select statement?

CREATE TABLE [dbo].[IndexTable](
[ID] [int] NOT NULL,
[Value] [varchar](50) NULL,
([ID] ASC)
INSERT INTO [dbo].[IndexTable]
 VALUES(1, 'value1'), (2, 'value2')
ALTER INDEX [PK_IndexTable] ON [dbo].[IndexTable] DISABLE
INSERT INTO [dbo].[IndexTable]
 VALUES(3, 'Value3') 
ALTER INDEX [PK_IndexTable] ON [dbo].[IndexTable] REORGANIZE
INSERT INTO [dbo].[IndexTable]
 VALUES(4, 'Value4') 
ALTER INDEX [PK_IndexTable] ON [dbo].[IndexTable] REBUILD
INSERT INTO [dbo].[IndexTable]
 VALUES(5, 'Value5') 
SELECT * FROM indextable
DROP TABLE [dbo].[IndexTable]

Answer: value1,value2,value5

Explanation: When a clustered index is disabled, its data rows cannot be accessed. This means that there will be no insertion process possible. Due to the same reason, even reorganization of the index is not possible until the clustered index (which was disabled) is rebuilt.

After the index rebuild happens, we are able to execute the final insert statement. I found Reference from the MSDN BOL:

» 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

Re-Trust Untrusted Foreign Keys and Constraints

This script will attempt to re-trust untrusted foreign keys and will report counts of successes and failures. 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

Check Database Integrity taking a long time - Hi Guys, I have just noticed that in the past few days a Maintenance Plan job that we have on...

how to find out the most frequently run queries in a database - I guess most likely some DMV captures that, but I could not find any. Does anyone know how? Thanks! Kathleen

SQL Server 2005 : SQL Server 2005 General Discussion

SHOW OFF DAY - HI i am making a attendance software and i want to show off days in my data my sql data is like...

SQL Server 2008 : SQL Server 2008 - General

How to avoid deadlocks - Hi, I am facing few problems with deadlocks. we have few tables and each table is having more than 6 million...

Collect data on the basis of timestamp from a table in a view - Hi, I am having data in a table in the form [code="other"]L_Limit U_Limit Asset Timestamp 10 20 1000 2013-06-14 16:52:57.910 20 30 1500 2013-06-14...

Backup SQL 2008 Small DB-Need Profesional Help - I am not an expert in SQL and our system crashed. The backup we set up did not work. Two our...

SQL Server transaction log backup procedure using batch file. - Hi Guys, Please provide sql server transaction log backup procedure to perform the backup automatically using batch file and that job...

SQL Server 2008R2 Cluster SAN - Hi, I would like to know if it's possible to install SQL Server binaries on SAN drives (as we only have...

Find out if replication failed. - Is there a way to find out (perhaps using DMVs) through TSQL if Replication failed between a given time frame?...

Insert is taking long time. - hi team, Insert one records is taking 8 to 1o seconds, indexes,stats every thing is good. i've rebuild the indexes also, same...

How to format the data in column in sql server - Hi, Please help me, In my table have a one date column. It contains data in different formats .I want...

How can we find the Null values on indexed columns from all tables in SQL Server. - Hi, Please help me on finding the Null values on indexed columns from all tables in SQL Server. I need a SQL...

SQL Server 2008 : T-SQL (SS2K8)

Need Query for a problem - Hello Everybody, Consider the following table, create table SampleTable (Category varchar(100), Organisams varchar(100) ) Insert into Sampletable values ('Animals','Lion') Insert into Sampletable values ('Birds','Dove') Insert into Sampletable...

Query for Emp Time Logging - This is a question asked in a test. There is a EmpWorkTime table having the columns and data as shown. ID Name...

SQL Server 2008 : SQL Server Newbies

ldf file size - Dear All I have a db for which recovory model is Full. And i am taking only full back up. .Ldf...

Simple Program - I am in the process of learning how to put together simple programs to iterate over a table dataset and...

SQL Server 2008 : Security (SS2K8)

How to prevent ANY use of xp_CmdShell? - Please forget whether or not you're pro or con on the subject of the use of xp_CmdShell for just a...

SQL Server 2008 : SQL Server 2008 High Availability

Replication SYNC Error - I have setup a new replication via backup and restore but its giving me two errors first "the row was...

SID Authentication vs Group Authentication - Can someone explain the difference what I mentioned in terms of clustering? SueTons.

SQL Server 2008 : SQL Server 2008 Administration

How to Export data from SQL Server to CSV using SQL server Management studio? - Hi All, Good morning, I have requirement export data from SQL server to CSV using SSMS, because we don't have access to...

Programming : Powershell

Write PowerShell Output to SQL Server Table - Heh... First time I've had to admit being a "newbie" in a long time so be gentle with me. I... : 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

Display all the days in a months in a matrix - Hi, Can someone please suggest, how this is can be done. I need to produce all the days in the month, to...