Problems displaying this newsletter? View online.
SQL Server Central
Featured Contents
Question of the Day
The Voice of the DBA
 

Grace Under Pressure

This editorial was originally published on Dec 10, 2012. It is being re-run for the Thanksgiving holiday.

I once worked at a large, 10,000+ person company. We had a large data center with hundreds of machines, where one day we lost power. Not power from the electric utility; no UPSs or generator kicking. We had a maintenance worker accidentally flip a switch and cause all of our UPSs to trip offline, cutting power to all the servers.

I was in the data center, surprised by the sudden quiet. Unfortunately, one of our senior executives was also in the data center and proceeded into the raised floor area. As various technicians and sysadmins attempted to restore power and reboot systems, this senior executive watched, commenting, questioning, and often berating the employees. Not a good situation for anyone, least of all the people trying to reconnect high-voltage wires together.

Most of you will never experience a large disaster and need to recover your systems. Even fewer of you will recover from disasters with anyone other than your peers or a direct manager watching you. However, you shouldn't count on being that lucky. Whether the disaster is small or large, your fault or a natural occurrence, I hope that you are able to successfully restore your systems with some professionalism and grace under pressure.

The key to a strong performance in a stressful situation is the same in technology as it is in sports, music, and almost any other endeavor with an audience. The key is practice.

Simulate disasters; pretend that a refresh of a development system is really a restore after a fire. Think about the various possible scenarios that might require you to recover a system and incorporate practice time into your daily routine.

Steve Jones - SSC Editor

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

 
 Featured Contents
SQLServerCentral Article

How to work with ChatGPT in Visual Studio Code

Daniel Calbimonte from SQLServerCentral

Learn how you can connect ChatGPT to VS Code and use it to help you fix your code.

External Article

Chebyshev’s Inequality in SQL Server

Additional Articles from MSSQLTips.com

In statistics when you have a dataset with no information about the shape of the distribution how can you estimate a safety net when you only know the mean and the variance? Let’s see how this can be done in SQL Server using Chebyshev’s inequality.

Blog Post

From the SQL Server Central Blogs - T-SQLTuesday 204: Are blogs still relevant?

Diligentdba 46159 from Mala's Data Blog

This month’s blogging party is hosted by Jeff Ianucci – his challenge is to blog on relevance of blogging. It took me a long time to get started with...

Blog Post

From the SQL Server Central Blogs - Are Blogs Still Relevant? I Think They Still Are.

MarlonRibunal from Marlon Ribunal - SQL, Code, Coffee, etc.

As for me, I'll keep writing whenever time permits. I don't expect every post to get hundreds of views or generate a lot of discussion. If someone finds an...

The Phoenix Project

The Phoenix Project: A Graphic Novel about IT, DevOps, and Helping Your Business Win

Site Owners from SQLServerCentral

Adapted from the acclaimed bestselling book, The Phoenix Project Graphic Novel Volume 1 introduces readers to a stalwart cast of characters as they are challenged by the four types of work that impact complex workflows.

 

 Question of the Day

Today's question (by Steve Jones - SSC Editor):

 

Finding the Black Friday Sales Ranking

We are tracking sales for Black Friday today. We have these aggregate values:
CREATE TABLE dbo.BlackFridaySales
(
    Product NVARCHAR(50) NOT NULL PRIMARY KEY,
    Units   INT          NOT NULL
);

INSERT INTO dbo.BlackFridaySales (Product, Units)
VALUES (N'55" TV',          900),
       (N'Air Fryer',       500),
       (N'Noise-Cancel Headphones', 500),
       (N'Robot Vacuum',    300);
I'm trying to get a ranking of the sales that would return 1, 2, 2, 3 for the product levels. Which query does this?

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

 

 

 Yesterday's Question of the Day (by Steve Jones - SSC Editor)

Switching Schema III

I run these queries:

SELECT COUNT(*) FROM dbo.Beer
SELECT COUNT(*) FROM etl.beer

I get 25 as the result for dbo.beer and 1 for the result for etl.beer.

Both tables have identical sructures and both of these are nonpartitioned tables. I run this code:

ALTER TABLE dbo.beer switch TO etl.beer
go
SELECT COUNT(*) FROM dbo.Beer
SELECT COUNT(*) FROM etl.beer

What happens?

Answer: An error is returned.

Explanation: The target table must be empty. There are still 25 rows in dbo.beer and 1 row in etl.beer. Ref" ALTER TABLE - https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-table-transact-sql?view=sql-server-ver17#arguments

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.


Anything that is NOT about SQL!
Life hack that has worked well for me - I wrote about this several years ago but will contribute again a life hack that has helped me.  It comes to mind again as I have just had to have a new pair of glasses made again because they did not follow my prescription.  Many of us spend many hours looking at computer displays, in […]
Editorials
Pay for Performance - Comments posted to this topic are about the item Pay for Performance
People Matter - Comments posted to this topic are about the item People Matter
Helping an English Student with R - Comments posted to this topic are about the item Helping an English Student with R
PASS Summit Week - Comments posted to this topic are about the item PASS Summit Week
Article Discussions by Author
Server-level Roles - Comments posted to this topic are about the item Server-level Roles
Tracking Inserted, Updated, and Deleted Rows with SQL Server OUTPUT - Comments posted to this topic are about the item Tracking Inserted, Updated, and Deleted Rows with SQL Server OUTPUT
Adding Bits I - Comments posted to this topic are about the item Adding Bits I
Implementing System-Versioned Temporal Tables in SQL Server: A Practical Guide - Comments posted to this topic are about the item Implementing System-Versioned Temporal Tables in SQL Server: A Practical Guide
Switching Schemas I - Comments posted to this topic are about the item Switching Schemas I
Enforcing Unique Customer Emails When Duplicates Already Exist - Comments posted to this topic are about the item Enforcing Unique Customer Emails When Duplicates Already Exist
Too Many Choices - Comments posted to this topic are about the item Too Many Choices
Table Partitioning in SQL Server: A Practical Guide to Managing Very Large Tables (VLDBs) - Comments posted to this topic are about the item Table Partitioning in SQL Server: A Practical Guide to Managing Very Large Tables (VLDBs)
SQL Server 2022 - Development
Trying to make this faster using not exists - Hi I have this query that is slow during the 'not in' part of the statement: LEFT JOIN dbo.benefitplan BP ON BP.benefitplan_id = ci.benefitplan_id LEFT JOIN dbo.benefitplan_type pt ON pt.benefitplan_type_id = BP.benefitplan_type_id WHERE k.BatchSeq BETWEEN '1' AND '1000000' AND ci.claim_procedure_id NOT IN (35381320,35381310,35381304,35381305,35381311,35381306,35345478,35381307,35381293,35381308,35392585, 35392587,35381298,35381321,35345407,35381324,35392582,35381326,35381299,35381325,35381295,35381323,35345410,35381297, 35336186,35381314,35345409,35381319,35392584,35336187,35336218,35336217,35381312,35381294,35381303,35381296,35381318, 35381300,35381327,35381315,35381317,35336185,35381309,35381322,35392586,35381313,35345408,35392583,35345477,35381316) where k.BatchSeq BETWEEN '1' AND '1000000' So I thought […]
Slow - Linked server query - Hi I have this slow query that is pulling data from a linked server. This is the slow part of the statement: SELECT c_sub.claim_id, MAX(cs.status_type) AS clm_status_type FROM dbo.tblBatchKeys k_sub INNER JOIN [SQL22.CARE.NET\SQL22NODEASTAGE]PROD.dbo.claim c_sub ON c_sub.claim_id = k_sub.claim_id INNER JOIN [SQL22.CARE.NET\SQL22NODEASTAGE].PROD.dbo.claim_procedure ci_sub ON c_sub.claim_id = ci_sub.claim_id AND ci_sub.claim_procedure_id = k_sub.claim_procedure_id INNER JOIN [SQL22.CARE.NET\SQL22NODEASTAGE].PROD.dbo.claim_procedure_status cs ON […]
 

 

RSS FeedTwitter

This email has been sent to {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.
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
webmaster@sqlservercentral.com

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -