SQLServerCentral - www.sqlservercentral.com

A community of more than 1,600,000 database professionals and growing

Featured Contents

The Voice of the DBA

A Double Dose of Trouble

It's Friday the 13th, during the month of October. Halloween, a strange holiday associated with horrible events, and Friday the 13th, a bad luck day, are happening this month. Both are associated with horror movies, implying that this isn't necessarily a good month for the world. It's a double dose of bad luck, which is what Equifax would have you believe. I wrote about this yesterday, where the company would have you believe a single employee makes a mistake when a scanner fails, and hackers were ready to attack.

I've, in general, had a lucky career. I've worked hard, and things have gone my way. That doesn't mean I haven't made mistakes or systems haven't gone down, but overall things have gone well. As I think about Friday the 13th of October, I'm reminded about Murphy's Law, where things that can go wrong, may just do so. I've tended to expect that some things will go wrong and prepare accordingly. In fact, in keeping with a corrollary that I've sometimes heard to Murphy's law that if one thing goes wrong, I'd expect that something else will fail.

On this double downer of a day, I'm wondering if you've experienced that. Have you had something bad happen at work, only to find that overshadowed by something worse? Hopefully you didn't make a security mistake and then get hacked, but perhaps something else has broken?

In my career, I've had this happen, though not directly to me. I consulted with a small company to make a little extra money and because I liked their business. I was rooting for them to succeed and wrote some database code to help speed up their application. One day they call me to say that a drive array failed with the database mdf on it. I wasn't worried, and while in another state, I was ready to walk them through a restore process on the new array. Unfortunately, this was a default install, and the default backup path was on the old array. I hadn't set this up, nor was I aware of their backup process.

The lead developer was proud of himself. He'd made a backup the day before, using a file share on a network drive. He had the .bak file. I thought this would be a quick and easy call until he read the error message that not all media sets were provided. That's when I realized that the developer, while making the backup in SSMS, hadn't cleared the previous backup file from the dialog. He'd inadvertently created a striped backup.

Eventually they managed to locate a backup that was many days old. I'm not sure how far back, but they angered a number of clients, who I'm sure all started looking for a new vendor. Eventually the company failed, and I moved on. There wasn't much to be done in that situation, but it was a certainly double dose of things going wrong at the same time.

I hope few of you have had double the bad luck in your career, but if you can share a story, we're happy to commiserate with you.

Steve Jones from SQLServerCentral.com

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

The Voice of the DBA Podcast

Listen to the MP3 Audio ( 4.8MB) podcast or subscribe to the feed at iTunes and Libsyn. feed

The Voice of the DBA podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music.

SQL Clone

SQL Clone: Now supporting databases up to 64TB

Create copies of production databases and SQL backups in seconds and save up to 99% of disk space using SQL Clone. Redgate’s new tool removes much of the time and resource needed to create and manage database copies, allowing teams to work on local environments to develop, test and diagnose issues faster. Try it free

SQL Compare

The industry standard for comparing and deploying SQL Server database schemas

Trusted by 71% of Fortune 100 companies, SQL Compare is the fastest way to compare changes, and create and deploy error-free scripts in minutes. Plus you can easily find and fix errors caused by database differences. Download your free trial

Featured Contents


A Lightweight, Self-adjusting, Baseline-less Data Monitor

Alex Chamchourine from SQLServerCentral.com

Can data alert us that something is going on, without baselines and thresholds? More »


How to import an existing database to ReadyRoll

The SQL Toolbelt includes ReadyRoll, which allows you to adopt a migrations-first approach to database source control and deployment. There are a number of different ways teams can get started with ReadRoll, and customers often ask how to get up and running when there is already an existing development database. More »


A Freecon Halloween at the PASS Summit

Press Release from SQLServerCentral.com

If you're attending the PASS Summit in 2017, there's a Freecon day on Tuesday you can attend. More »


From the SQLServerCentral Blogs - This Made Me Laugh: SQL v NoSQL

Steve Jones from SQLServerCentral Blogs

It’s a humorous history lesson on SQL (and product promotion), but it opens like this: SQL awakens to fight the dark... More »


From the SQLServerCentral Blogs - What is DBCC CLONEDATABASE ?

DBCC CLONEDATABASE is new feature comes up with SQL Server 2014 SP2 and above. DBCC CLONEDATABASE is used to create... More »

Question of the Day

Today's Question (by Steve Jones):

It's Friday the 13th. Which of these is most appropriate in AdventureWorks2012?

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

We keep track of your score to give you bragging rights against your peers.
This question is worth 7 points in this category: humor.

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


Exam Ref 70-761 Querying Data with Transact-SQL

Prepare for Microsoft Exam 70-761–and help demonstrate your real-world mastery of SQL Server 2016 Transact-SQL data management, queries, and database programming. Designed for experienced IT professionals ready to advance their status, Exam Ref focuses on the critical-thinking and decision-making acumen needed for success at the MCSA level. Get your copy from Amazon today.

Yesterday's Question of the Day

Yesterday's Question (by Steve Jones):

I want to convert datetime values to datetimeoffsets to ensure all my time values are consistent and comparable. I decide to use TODATETIMEOFFSET() to do this. What do I need to pass in as a parameter(s)?

Answer: The datetime value and the hours and minutes offset.


The TODATETIMEOFFSET() functiont takes a datetime value and an offset for the timezone in minutes/seconds. This can be an integer for minutes or a string for hours and minutes.

Ref: Stairway to Advanced T-SQL Level 9: Compare, Modify, Derive and Validate Date and Time Values

TODATETIMEOFFSET - https://docs.microsoft.com/en-us/sql/t-sql/functions/todatetimeoffset-transact-sql

» Discuss this question and answer on the forums

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 2016 : SQL Server 2016 - Administration

Version or Source Control for SQL Objects - Evening All, What are you all using for Version and Source Control? And how do you find it?

SQL Server 2016 : SQL Server 2016 - Development and T-SQL

Compression Script on existing tables in databases that handles the alters and indexes and tells how much savings? - Hi, is there a tried and true generic script available that I can run that will go through each database...

User Defined Aggregate assembly / CLR / Database compatibility level - Hello, I'm having a weird behavior on a clr aggregate function. (concatenation of several strings using a delimiter - code below) -...

Order by issue - All, I have the following CTE: DECLARE @SQLStr

SQL Server 2014 : Development - SQL Server 2014

Having trouble displaying a date in a certain format... - Select Invoice_Exceptions.Invoice_Number, Invoice_Exceptions.ItemNum, Inventory.ItemName, Invoice_Exceptions.Amount, Invoice_Exceptions.Quantity, Invoice_Exceptions.Reason_Code, Invoice_Exceptions.LineNum, Invoice_Exceptions.EmpName, Invoice_Exceptions.DateTime AS Day_Voided, Invoice_Totals.Payment_Method From Invoice_Exception

Creating Stored Procedure - New to SQL Server. Looking for help with the following design problem: Query: Create a procedure named 'delete_asset_log' that takes 1 input...

Columnstore index question - I have some large ETL tables that i've created to snapshot production OLTP data that is sourced from more than...

SQL Server 2012 : SQL 2012 - General

Transaction log grows. Strangely problem - Hi Guys! I have a really strangely problem. I have Hyper-V virtual server with installed  Microsoft SQL Server 2012 (SP3-CU10) (KB4025925), Database...

SQL Server 2012 : SQL Server 2012 - T-SQL

Need Help in slicing the records from 200 million rows - Our table holds 200 million rows with 180 columns. We are planning to implement a batch wise records insert for...

Can't zero pad a variable - For some reason I can't pad an early day of month with '0'. Not sure why. There are no mixtures...

Sql Code help pulling date range before an status - Hi All, Hello, I have an issue in finding out the date range and id previous to an event. here I...

expecting ID or quoted_ID. Help! - error i'm getting  from the below query: Incorrect syntax near '@DatabaseName'. DECLARE @DatabaseName as NVARCHAR(200); DECLARE DatabaseCursor CURSOR FOR SELECT Name FROM sys.databases WHERE...

Indexing strategy on a highly transient table - Hi, I'm just looking for a disscussion about the best indexing strategy for a table I have that's in a...

SQL Server 2008 : SQL Server 2008 - General

Scalar function syntax error - I have two functions that work.   "A" and "B"   When I tried to modify "A" to have condtiions like "B"...

SQL Server 2008 : T-SQL (SS2K8)

Stored procedure to pass date ranges - I would like to write a stored procedure that use the date range for the different sum and count functions....

Reporting Services : Reporting Services

ssrs 2008 report parameters - In an existing SSRS 2008 report, I am adding a new tablix and a new dataset to the rdl. This...

Reporting Services : Reporting Services 2005 Administration

Unable to access Reporting services reports from application - We have configured the reporting services to view the application reports. Report server is hosted in one system and application...

Data Warehousing : Integration Services

Script Task to check file existance is OK in Visual Studio but fails when Deployed - Hi, Within a Foreach loop, I have a simple Script Task to check if a file exists. If it exists, then FTP...

Data Flow Task Error: The version of ODBC Source is not compatible with this version of the DataFlow - So, that is the error I am getting when I attempt to execute my extremely simple SSIS package.  How simple?...

SQL Server 2005 : Development

Dynamic decimal precision - I need the precision of a decimal value to be dynamically controlled. Example: DECLARE @input as decimal(16,6) SET @input = 1.234567 DECLARE @precision...

This email has been sent to {user_email}. To be removed from this list, please click here.
If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com.
This newsletter was sent to you because you signed up at SQLServerCentral.com.
Feel free to forward this to any colleagues that you think might be interested.
If you have received this email from a colleague, you can register to receive it here.
This transmission is ©2017 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
Contact: webmaster@sqlservercentral.com