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

Daily Coping Tip

Stay fully present while drinking your cup of coffee or tea

I also have a thread at SQLServerCentral dealing with coping mechanisms and resources. Feel free to participate.

For many of you out there working in a new way, I'm including a thought of the day on how to cope in this challenging time from The Action for Happiness Coping Calendar. My items will be on my blog, feel free to share yours.

My Time is Valuable

In most of my jobs, I've been given tasks to accomplish, often without a lot of my own input. Someone triages work, or developers a project plan and assigns me things to do. Often these are fairly narrow pieces of work, but with some latitude on how I might actually complete the task.

Over the years, I've been asked to do things which weren't a part of my job. At one small company, I spent an afternoon making Ethernet patch cables because we needed them, I knew how, and my boss said it was a good break for the two of us. At another job, I was asked to help go through the separation process when employees left, zipping up files, archiving mailboxes, etc.

At the same time, I recognize that for my salary, neither of those were a good use of my time. At least not from an ROI perspective for the company. Those are simpler, low value tasks, and for someone that is paid above a beginning level, these were expensive resource costs.

As we look to improve how software is built *and* managed, we want to take away low value tasks that don't require human intervention. We want to use computers to do as much of those tasks as we can. That's a lot of what DevOps tries to get us to adopt as part of our daily work.

However, this can even include tasks where we might think a human is needed. I heard someone say recently that they shouldn't be spending time with auditors walking through logs or looking up process documentation. That stuff ought to be produced and available by systems.

Improving the efficiency of our workforce should mean that we don't spent time doing simple things that can be handled by computers. Sometimes it's not easy to decide if the automation or tooling is necessary, but at each point we ought to consider the cost of building and maintaining some solution over the cost of an individual spending time there. Often, though not always, we can find a little software development saves a lot of future costs.

Steve Jones - SSC Editor

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

 
 Featured Contents

Getting a Query Execution Plan in PostgreSQL

sabyda from SQLServerCentral

Introduction You often need to check the performance of a PostgreSQL query you just wrote to look for some way to improve performance. In order to do this, you need a report of the query execution, which is called the execution plan). The query execution plan gives you the entire summary of the query execution […]

A data transformation problem in SQL and Scala: Dovetailing declarative solutions

Additional Articles from SimpleTalk

This article is an interesting approach to solving a data transformation problem in SQL and Scala. Shel Burkow uses a SQL execution plan for software design.

From the SQL Server Central Blogs - Webcast Recording – Building a Proper SQL Server DB Security Model

K. Brian Kelley from Databases – Infrastructure – Security

The recording for my presentation on Building a Proper SQL Server DB Security Model is now available. It’s right at an hour long and in it I present a...

From the SQL Server Central Blogs - Server Review Essentials for Accidental and Junior DBAs—Client Onboarding (Part 3)

Kevin3NF from Dallas DBAs

The next post of this series is finally ready to fly. I apologize for the delay between posts, but between the rolling blackouts in Texas during the 2021 Snowpaclypse...

 

 Question of the Day

Today's question (by The Dixie Flatline):

 

How Many Rows Inserted?

Without running the code below, how many rows will be in the #table at the end of this batch?
IF OBJECT_ID(N'tempdb..#table') is not null DROP TABLE #table

declare @TC int

CREATE TABLE #table (SomeData varchar(20) primary key)

SET IMPLICIT_TRANSACTIONS ON

SELECT 'After Set Implicit, @@Trancount='+str(@@TranCount)

BEGIN TRAN

SELECT 'After Begin Tran, @@Trancount='+str(@@TranCount)

INSERT INTO #table
SELECT 'X'

IF @@TRANCOUNT > 0
COMMIT TRANSACTION;

set @TC = @@TRANCOUNT

SELECT 'After COMMIT @@Trancount='+str(@TC)
union all
SELECT 'After COMMIT #table has'+str(count(*))+' rows.'
FROM #table

if @@TranCount > 0
ROLLBACK

set @TC = @@TRANCOUNT

SELECT 'After ROLLBACK @@Trancount='+str(@TC)
union all
SELECT 'After ROLLBACK #table has'+str(count(*))+' rows.'
FROM #table

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)

Which place

I have this code in R:

which(letters =='z')

What does this return?

Answer: 26

Explanation: letters is a known variable in R, which contains all the Roman English alphabet. The which() function returns the place of the matching value(s). In this case, 26. Ref:

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 2017 - Administration
problem Deadoolk in my instance - Good morning all I reset a deadlook problem every 10 minute Who can help me please optimize the execution of these requests   Please find attached the execution plan of my request select FMENV.ENVIDX as IDX, 3 as Entity, FMBATCH.BATLOGNAME as FM_Batch, FMENV.ENVIDX as FM_Document, FMENV.ENVLOGNAME as Name, FMENTPROP.EPRCUST19 as FM_ID_Client, FMENTPROP.EPRCUST09 as FM_Checking, FMCATEGORY.CATDESC […]
Connecting to SQL 2017 with SQL Server Driver from Windows 2012R2 - Hi we have a legacy application that connects from the application servers (Windows 2012 R2) to the SQL servers using the SQL Server driver. This work fine against an old version of SQL, but we're upgrading to SQL 2017, and it no longer connects. You can connect from Windows 10 using the SQL server driver. […]
Most accessed tables/indexes - This is a generic question to know more about SQL server performance.Nobody has complained of any performace issues on our servers, but there is an agenda to know the existing performance and how that can be improved upon. What are the metrics that need to be captured to identify a baseline for a sql server […]
SQL Server 2017 - Development
GROUP BY with SELECT SUM - Why is this not working? Field 'EmpNo' not contained in either an aggregate function or the GroupBy clause SELECT EmpNo, SUM(Time1) AS TotalTime, Dept, Job, Description, Rework FROM TimeData2 GROUP BY EmpNo
SQL Server 2016 - Administration
sql 2016 alwayson question about failover - Hi guys, i have this question. we have 2 sql 2016 standard with some databases replicated with basic alwayson. So last night the primary server crashed (BSOD and reboot) and the secondary sql has started the failover. This morning i have done a manual failover to move again the DB on primary server. i have […]
SQL Server FC 2016 on Windows 2016 - Random Cluster Failure - Hi, For about a week my cluster is failing. It starts with event log: and immediately: After that is down the drain. One of the nodes freezes, SQL instances/roles are green but inaccessible. The server isn't releasing them unless, I just turn it off. This is when the roles migrate. It is not hardware as […]
Licence SQL server Edition developper sous une machine EC2 - Good morning all Can I take advantage of the fact that the SQL develop license is free to install it on EC2 AWS machine?Is the use of SQL developing ON EC2 AWS free thank you for your clarification
Administration - SQL Server 2014
Shutdown order for nodes in AG and quorum disk - When shutting down the whole farm environment with two nodes in Failover Cluster/AG, my thinking is to shutdown secondary first and then primary. When bringing up, start with primary and then the secondary. What I noted was when the secondary was brought up first and then the primary, the databases synced and AG dashboard showed […]
Development - SQL Server 2014
How to Structure Data table/fields when using Multiple Select Drop Down - Hello, I am interested in using a multi-select drop down on an application interface and am looking to understand how to handle this at the database level to (1) Store the data, (2) Query the data.  Below is an example of the concept. I have a drop down with multiple check boxes that asks, "Please […]
Sql query - Projected Monthly Revenue - Hi, I've been sitting with a projected revenue query for sometime , trying to figure out the best way to do this. Basically, I'm trying to get a monthly revenue number based on daily shipment totals. eg:  Total Rev MTD  $88,720 / 9 days =  $9,857 *  23 shipping days = $226,731 as Monthly Project […]
Clone a table from a script - I have a table schema in an exported .sql file (text). Is there any way to use that to create an identical table (with the name changed of course)? The file was created using script table as -> create to -> file. TIA  
SQL Server 2019 - Administration
Encrypt/Decrypt issue - Version :Microsoft SQL Server 2019 (RTM-GDR) Followed these links as underneath: https://www.mssqltips.com/sqlservertip/2431/sql-server-column-level-encryption-example-using-symmetric-keys/ https://www.surekhatech.com/blog/column-level-encryption-and-decryption-in-mssql I created 2 tables. For the first table I inserted individual rows (with encryption as in the links) and when I did a decrypted select.The result came out perfectly.No issues.The result showed the original password column,encrypted password column and then the decrypted […]
SQL Server 2019 - Development
Help with non-clustered index fragmentation - I'm trying to rebuild indexes to clear some heavy fragmentation in the nonclustered indexes.  I've tried ALTER TABLE dbo.POHeader REBUILD and ALTER INDEX idxPOHeader_EntryDate ON dbo.POHeader REBUILD Neither affects the index fragmentation. What is the correct method to resolve this.  
Reporting Services
Printing from generic SSRS report - I have a generic SSRS report that contains some text and bar codes. I wish to print it but when I try to export it to PDF the bar codes are replaced by the strings they represent. When I right click on the report and try to print, I get all of the surrounding info […]
Integration Services
VS 2015 deploy to SQL 2019 - Hi We just had a SQL upgrade (SQL 2019) in our dev server and our SSIS solutions no longer work. We are using Visual Studio 2015 and the solutions run fine locally from within VS. Is there a compatibility issue between VS2015 and SQL2019? I can't find much on the web. In VS, the solution […]
 

 

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

 

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