SQLServerCentral - www.sqlservercentral.com

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

Featured Contents

The Voice of the DBA

The Worst Day

I challenged people to write about their daily work a few weeks ago. I haven't see a lot of posts, but I am still hopeful some of you will document your day, as Iris Classon has done a few times. It's not that I expect a lot of the same posts, but rather, I'd like you to talk about the way a specific day has flowed for you. Did you work on a problem? Just pick up tickets and perform routine scripting? Learn a specific thing? Give us some details. I expect everyone's day to be different.

Jon Shaulis broke his series in a few parts, one of which was his worst days as a DBA. I thought that was interesting and it brought back from memories for me. Overall, I've had mostly good days, and even the crisis situations weren't that bad.  That being said, there are some tough days, both physically and mentally, and worse, tough for my family.

This week, I wanted to ask you what was the worst day in your career? Or maybe the worst event, since some of the tough times I've had actually spanned multiple days. Let us know what happened, but also, what the challenge was for you?

I've got a couple items. My first exposure to SQL Server was as a network admin. I helped a group of 4 other FTEs run a large Novell Netware environment of over 1000 nodes. We handled the servers (6 or 7), email, and more for hundreds of employees. We managed Netware servers, Windows (and DOS) desktops, and way too many printers. As a part of a government mandated change, we rolled out a new system at midnight on Jan 1, backed by this new database, SQL Server. We installed an OS/2 server at the end of December and prepared for the cutover from the old system. Since this was a mandated change, we weren't going to roll back. Ever.

I arrived at work on Dec 31, around 6pm. I planned on getting setup, checking with developers, and being ready. We cut over at midnight and people began using the system. Within 30 minutes, we had problems, including an overloaded SQL Server that would freeze up. We ended up babysitting the server to reboot it regularly, as well as trying to determine the problems. I left work on Jan 2, around noon. That was a bad day.

Another bad way was with a SQL Server 6.5 instance that ran financial services. We detected corruption in a table and got on the phone with Microsoft one afternoon. I worked with support, being handed off from the west coast to Asia to North Carolina throughout the night, trying to debug the problems and extract data. A nice 30+ hour, high stress day for me. After that I kept a pillow and blanket in my desk, which I used a few more times that year.

Those were tough times, but most of my days are great. Some are long, some stressful, but overall, I've enjoyed my time doing database work. Can you say the same thing?

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 ( 5.3MB) 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.

ADVERTISEMENT
SQL Prompt

Become a more efficient SQL developer with SQL Prompt

Learn how to write SQL faster and more efficiently with these exclusive short videos from Data Platform MVPs and SQL Server experts. With SQL Prompt you can strip out the repetition of coding and write SQL 50% faster. Check out the tips

SQL Source Control

How to track every change to your SQL Server database

See who’s changing your database, alongside affected objects, date, time, and reason for the change with SQL Source Control. Get a full change history in your source control system. Learn more

Featured Contents

 

Learning about FOR JSON

Site Owners from SQLServerCentral.com

Links and information about the FOR JSON clause in SQL Server 2016. More »


 

Rounding Tips and Tricks

Luis Cazares from SQLServerCentral.com

This article shows different options to use the rounding functions in SQL Server. More »


 

Common Entity Framework Problems: N + 1

Additional Articles from Brent Ozar Unlimited Blog

Richie explains why your app is running so many queries. More »


 

From the SQLServerCentral Blogs - Save the Connection String Parameters in SSMS – AlwaysOn

Dharmendra Keshari from SQLServerCentral Blogs

In the SQL Server AlwaysOn setup, whenever you are using a listener to connect to a secondary node, you have... More »


 

From the SQLServerCentral Blogs - SQLCMD mode in SSMS

carlos10robles from SQLServerCentral Blogs

I really like Microsoft philosophy nowadays, they are putting a lot of time developing good open source tools like SQLCLI,... More »

Question of the Day

Today's Question (by Steve Jones):

I am writing a trigger that is going to take action if either of two columns are changed. I want to use the UPDATE() function for these columns. What will this return for my code to use?

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 1 point in this category: UPDATE().

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

ADVERTISEMENT

Pro Power BI Desktop

This book shows how to deliver eye-catching Business Intelligence with Microsoft Power BI Desktop. You can now take data from virtually any source and use it to produce stunning dashboards and compelling reports that will seize your audience’s attention. Slice and dice the data with remarkable ease then add metrics and KPIs to project the insights that create your competitive advantage.

Yesterday's Question of the Day

Yesterday's Question (by Steve Jones):

On SQL Server 2017, I have this data in a table:

 CREATE TABLE Scorers ( playername VARCHAR(200), points INT) GO INSERT dbo.Scorers VALUES ('Kareem Abdul-Jabbar', 38387), ('Karl Malone' , 36928), ('Kobe Bryant' , 33643), ('Michael Jordan' , 32292), ('Wilt Chamberlain' , 31419), ('DIRK NOWITZKI' , 31187), ('LeBRON JAMES' , 31038), ('Shaquille O''Neal' , 28596) GO 

I decided to run this query because I want to know how many points behind the leader (Kareem Abdul-Jabbar) everyone is:

 SELECT 'Player' = s.playername , 'CurrentValue' = s.points , 'Points Behind Leader' = LAST_VALUE(s.points) OVER (ORDER BY points DESC) - s.points FROM dbo.Scorers AS s ORDER BY s.points;

What results do I get for the Points Behind Leader column?

Answer: I get all zeros

Explanation:

One would expect that LAST_VALUE() would ensure that the last value (highest based on ordering) of the partition would be returned. Since all the rows are in the same parition, we might expect that, but we don't get that.

Instead, LAST_VALUE() works with the last value of the frame, which is UNBOUNDED PRECEEDING, meaning all rows before this one. The subtraction means each row gets a 0, returning the current points value and subtracting the current points value.

Ref: LAST_VALUE() - click here


» 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

Separate DB, log and Temp drives ? - These days, is there actually any point ? Using VM's and SANS, is there any real point in separating data, logs...

Distributed AG with AutoSeed - Hi, For setting up Distributed AG why it is needed to create Availability Group with Automatic seeding?

Initial load of data to table slow - First let me say I'm not a DBA.  I'm looking for some suggestions from others who have ran into this...

Good script to analyze Buffer pool - Can someone please share a good script to analyze buffer pool, would like to free space ,used space by different...


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

SP sending email alerts - Good afternoon, Forgive me but I am new to this, I have been given a SQL server to look at that...

Partioning Huge Table (650GB about) - Hi all, in my data warehouse (SQL Server 2016 Std) I need to maintain 36 (!!) versions of a table in order...


SQL Server 2014 : Administration - SQL Server 2014

Database logs file size, is normal to have a data log file bigger in size than the data files. - I am starting with the database support to a SQL Server database, this database has two data files and one...

DB Autogrowth - Hi Experts, Which option is best Filegrowth by 10% or in Megabytes for a large database that grows with average 40GB...


SQL Server 2014 : Development - SQL Server 2014

Count the amount of times values appear in the database - Hello, I have a table of "jobs" which I need to export to an online accounting software. What I need to...


SQL Server 2012 : SQL Server 2012 - T-SQL

index join and index intersection - Can anybody tell me the difference b/w index join and index intersection.

View created by joining three tables (using Left outer join) takes more time to execute - I had created a view by joining three tables as follows, SELECT  ROW_NUMBER() OVER (ORDER BY dbo.PhoneBook.PhoneBookID) AS MyPrimaryID, dbo.PhoneBook.PhoneBookID,...


SQL Server vNext : SQL Server 15 - Administration

Enable Logging of both failed and successful logins on Linux - Anyone seen how you do this? On a Windows Environment you can just do this via the Server Properties Window,...


SQL Server 2008 : T-SQL (SS2K8)

please help !! Dynamic SQL - Hi experts Please I REALLY NEED YOUR HELP !! I want to create a dynamic sql in a cursor. I want to replace...

DATEPART WEEK start Monday - Hi, I'm doing this directly in a computed column: case when

Insert XML data with Namespace into SQL Table - I am in a situation where a system throws a xml file ( I don’t have any control to change this...


Reporting Services : Reporting Services

Missing folder C:\Program Files\Microsoft SQL Server\MSRS14.SQL2017\Reporting Services\ReportServer - Hi, I have a report server and I have a few reports deployed to it. I am trying to configure it to...


Programming : Testing

tSQLt AssertEqualsString - Is it possible to force a case sensitive comparison? ie. i want this to fail: EXEC tsqlt.AssertEqualsString 'Test','test';


Programming : SSDT

SSDT install fails in VS 2017 enterprise edition - Hi ,  I am unable to install SSDT for integration services for Visual Studio 2017 . I downloaded Analysis Services and reporting...


SQL Server 2005 : SQL Server 2005 Integration Services

Isses with upgrading SSIS components (from 2008 to 2014) that programatically generate packages - Problem: We needed to upgrade SQL Server from 2008 R2 to 2014. In addition to using couple of static SSIS packages,...

Import Multiple Excel files into a Database - Hi, I need to import +/- 500 xls files into my sql server 2005 database. Is there a way I can...

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