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

Daily Coping Tip

Look around and spot 3 things you find unusual or pleasant

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.

When Do We Ask for Help?

One of the things I try to teach and stress to others when I'm in a team is that while they need to make an honest effort to solve a problem themselves, there are times that they need to ask for help. Spinning on a problem for days isn't helpful to anyone, and even if you do find a solution, it's likely that the time wasn't well spent for the organization.

At the same time, asking someone, or everyone in Slack with an @here, can interrupt and disturb others, causing them to lose their focus. Having someone always interrupt others is also annoying, and can feel like the asked is placing the burden on others to get work done by the others.

I saw an interesting post from a software engineer on when to ask for help. The general rule of thumb was to not spend more than an hour, which I think makes sense. There's also a formula, which takes into account how long you've spent, how long to explain things, and the relative value of someone's time. I don't know if this is a good formula, but there is one good thing.

Write down what you've done. We ask that of people posting at SQL Server Central, and we have etiquette advice on SQLServerCentral about how to post a question, as well as numerous blogs that have tackled the same topic. As the main post above notes, often going through what you have done can help unblock you from simple or silly mistakes.

This is good for general problems, the normal flow of work. In the post, the engineer talks about adopting cloud native techniques, which is likely similar to how orgs might adopt DevOps techniques. In those cases, I do think you might add a step to any problem solving: documentation.

As you learn something, document it for the team, with some eye towards teaching others a few things. We don't want everyone solving the same problem, even if it's through search. Instead, we want people to have a resource to check first: a list of the problems we've already solved, codifying the knowledge of the team.

Steve Jones - SSC Editor

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

 
 Featured Contents

An Overview of STRING_SPLIT()

Steve Jones - SSC Editor from SQLServerCentral.com

Learn how to use the STRING_SPLIT() function in T-SQL.

Why is my SQL Server Query Suddenly Slow?

Additional Articles from Redgate

A SQL Server query is suddenly running slowly, for no obvious reason. Grant Fritchey shares a 5-point plan to help you track down the cause and fix the problem.

Power BI Smart Narrative

Additional Articles from MSSQLTips.com

A new feature in Power BI is the Smart Narrative that allows you to add a textual narrative to your reports to help provide additional information to the user.

From the SQL Server Central Blogs - A blog post about writing blog posts

Randolph West from Born SQL with Randolph West

I recently wrote about how I teach, in response to a T-SQL Tuesday post from 2010. This is a continuation of that theme, suggested by my own editor. Thanks,...

From the SQL Server Central Blogs - 3 Highly Improved Help Queries for XEvents in Azure SQL

SQLRNNR from SQL RNNR

XEvents is here to stay and is a powerful tool for ALL of your SQL implementations - whether they be Azure SQL or the traditional on-premises SQL Server.
The post...

 

 Question of the Day

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

 

Global Git Ignore

If I want to globally ignore certain types of files in my local git install, what easy thing should I do?

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

 

 

 Yesterday's Question of the Day (by Peter Petrov)

NULLIF and 0

What is the outcome for the script:

SELECT NULLIF(0,'0')
SELECT NULLIF(0,NULL)
SELECT NULLIF(0,'')
SELECT NULLIF(1,'')

 

Answer: NULL, 0, NULL, 1

Explanation: Obviously the problematic expression is SELECT NULLIF(0,'') and it gives you NULL because the data type of the first argument applies to the second argument and the implicit conversion is:

SELECT CAST('' AS int)

Apparently it gives you 0. One explanation is that the empty string implies you meant "nothing" and "nothing" in the integer world is... 0. Ref: NULLIF - https://docs.microsoft.com/en-us/sql/t-sql/language-elements/nullif-transact-sql?view=sql-server-ver15

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
Cumulative Updates - I am about 6 versions behind on my cumulative updates, and need to apply the latest one. I have looked for detailed documentation but haven't found any yet. I have a DEV environment and a test environment that I can apply it to first, however, these environments will not have the workload of the production […]
SQL Server 2017 - Development
Substract 2 values - Hello, I would like to minus from rows. 'Other Cost' minus the rest of the rows. select 1 Period,'Main' Category,100 Value union all select 1 Period,'Cost' Category,5 Value union all select 1 Period,'OtherCost' Category,20000 Value I tried like this but is not working. Can someone guide me. select Period,Category , SUM(CASE WHEN Category='Main' THEN [Value] […]
pagination with case - Have a requirement of case , pagination in Order by clause. It looks something like this. But getting error. how to fix ORDER BY case when (@PageCount <= 0 OR @PageIndex <= 0) then c.fullname else ( c.fullname OFFSET (@PageCount * (@PageIndex - 1)) ROWS FETCH NEXT @PageCount ROWS ONLY ) end    
SQL Server 2016 - Administration
Statistics Update Frequency - What's the best way to know which index statistics need to be updated on a daily basis?  I currently update stats on Friday, but I've noticed SQL is updating some of my stats automatically.  The issue is the auto update of stats doesn't do a full scan, so it causes slowness and bad query plans.  […]
SQL Server 2016 - Development and T-SQL
Counting Instances in TEXT - Hello Community, I have been presented with the following SQL challenge Find the number of times the words 'bull' and 'bear' occur in the contents. We're counting the number of times the words occur so words like 'bullish' should not be included in our count. Output the word 'bull' and 'bear' along with the corresponding […]
Copy tables from one db to another db - I have a user that needs to truncate a number of tables in DB2 and then make a backup of some tables from DB1 before a lengthy import process begins. What I would like to do is have the user call an SP that truncates the destination tables in DB2 and then copies the data […]
Administration - SQL Server 2014
Space Error - Hi Experts, I got error on one of our production database. Could not allocate space for object 'dbo.'.'' in database '' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup. […]
Development - SQL Server 2014
Is this a RBAR? - DECLARE @forms TABLE ([Id] int NOT NULL); INSERT INTO @forms ([Id]) VALUES (2481916), (2481917), (2481918), (2481919), (2481920), (2481921), (2481922), (2481923), (2482093), (2482094), (2482095), (2482096), (2482097), (2482098), (2482099), (2482100) DECLARE @versions TABLE ([FormVersion] int NOT NULL, [FormId] int NOT NULL, [CreatedDateTime] datetime); INSERT INTO @versions ([FormVersion], [FormId], [CreatedDateTime]) VALUES (1, 2481916, '2021-01-01'), (2, 2481916, '2021-01-02'), (1, […]
SQL 2012 - General
how to do the following operation while the tables under different schema? - how to do the following operation while the tables under different schema? for example, there are two tables with same name but under different schema in the same database, one table saletable under schema A and the other table saletable under schema B, how to do this operation , such as sp_helpindex , sp_spaceused and […]
SQL Server 2019 - Administration
"execute as login" limited to the query window? - Hi! Let's assume I'm doing "execute as login='user1' " and that user 1 only has access to northwind_spp database. If I try to run something under it such as "select * from adventureworks2019" it will give an error that this user1 does not have access to that database. However, if I go to the left […]
How to Export Yahoo mail to Gmail - I want to export my emails from Yahoo Mail to Gmail account.
TDE + Encryption key in Azure Key Vault - Hi all, I have SQL 2019 server with Always On of a few servers. I am using TDE on the DBs with encryption key managed by Azure Key Vault (AKV). From time to time, as every Azure managed service, the AKV is not available for different time periods which causes us to have the DB […]
SQL Server 2019 - Development
Only lists records when StockValue changes - Good day, After running below create and insert scripts, my query should only return the rows in blue color (when StockValue changes from IN to SOLD , SOLD to IN, IN to SOLD) I've listed 2 NR's to help with understanding what I'm looking for. Can anyone help me with this? Thank you
SSIS SQL Agent Job - SQL Step referring other server - Hi there, everyone. I have a bit of a pickle. I need to move all our SSIS jobs from one server to another. The problem is all the databases that are used / queried also reside on the same server. One of the jobs has a step that runs a SQL query inside that actual […]
Amazon AWS and other cloud vendors
use SCT to synchronize schema - Hello , I did a SQL database migration to RDS AWS DMS there were missing objects (index, foreign key, founction) Can I use SCT AWS Schema Conversion to add these objects? thanks
 

 

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

 

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