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

Daily Coping Tip

Let go of other people’s expectations of you

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.

The Right Connection

This editorial is being re-published as Steve is on vacation. It was originally released on Apr 19, 2018.

Travis-CI had some staffers connect to the wrong database and truncate production tables. Needless to say this caused an outage and disrupted their business. Hopefully they didn't lose too many customers, but they certainly did not help their reputation. I'm sure there are more than a few customers trying to decide if they continue to trust the company or move their Continuous Integration (CI) processes to another platform.

I've done this before. Not shut down a company, but I have actually truncated a production table by mistake. Well, not TRUNCATE, I mean, who runs that. But I have run a DELETE without a WHERE clause and killed a lookup table in a production database. Fortunately I had a copy of the table elsewhere and could rebuild it in minutes. Only a few customers had their work interrupted and only for a portion of our system. The point is that I've been a very good DBA, with a lot of success and experience, and I still make mistakes.

Often this type of mistakes comes about because we get busy, and we keep connections open to different systems. When we might be developing code against a schema that is close to production, it's easy to forget which database we're working on. Someone calls with a problem or we fight a fire, and we run some code. We fix the issue, stress bleeds away and we go back to work, but forget to switch connections or tabs. Then we run some code that would be fine in development, but causes issues in production.

SSMS has colors for a connectionSQL Prompt has tab coloring by system and database, as do some other products., which can help, but it isn't perfect. One thing I've found with colors is that if I use them constantly, my mind starts to filter out the color. I don't always realize the outline of the tab is a different color. This is especially true if I have the need to switch back and forth between both production and non-production systems. I've tried running two instances of SSMS, which helps, but at times I'll forget which one I'm working with and make a connection to a production server from a non-production instance of SSMS.

Ultimately, we need to be careful. I know one friend that has no access to production and must hop through an RDP session and connect to a production database. However, if you run your RDP session in full screen, how often would you forget that you're in the SSMS on the hop system and not in SSMS on your local machine.

I don't know if there's a good solution. Many of the convenience features that make life easier, like reconnecting tabs when I restart SSMS are great, however, they can compromise security and safety. I don't know if there is a good solution, but I'd certainly like more checks against ad hoc issues occurring in production systems. Maybe some sort of lock against certain instances that prevents destructive execution on certain instances or databases without some confirmation. I love SQL Prompt preventing me from running code without WHERE clauses, but that isn't always enough. At least not for me.

Steve Jones - SSC Editor

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

 
 Featured Contents
Stairway to SQL Server Security

Stairway to SQL Server Security Level 4: Permissions

Don Kiely from SQLServerCentral.com

A permission gives a principal access to an object to perform certain actions on or with the object. SQL Server has a mind-numbingly huge number of permissions that you can grant to a principal, and you can even deny or revoke those permissions. This sounds a bit complicated, but by the end of this stairway level you’ll understand how SQL Server permissions work and how you can exert very granular control over object creation, data access, and other types of actions on database and server objects.

External Article

Easy and Cost Effective way to Encrypt Every SQL Server Database

Additional Articles from MSSQLTips.com

Learn why Becton Dickinson has selected DBDefence to protect their SQL Server data across numerous medical devices in a cost effective manner.

External Article

Redgate Summit: The Database DevOps Transformation

Additional Articles from Redgate

Digital transformation and data modernization are frequently cited as high-value strategic projects that are crucial to achieving competitive advantage. At the same time, delivery of code in agile and predictable ways has led to many businesses adopting DevOps practices. Throughout this event we will explore how Database DevOps can be the function that accelerates transformation projects.

Join us On October 6th as we invite experts to share their insider tips and tricks.

Blog Post

From the SQL Server Central Blogs - Power BI Desktop overwrites Authentication Settings in Similar Connections

Koen Verbeeck from Koen Verbeeck

Yesterday I was facing an annoying issue. I have two Power BI datasets. Both connect to the same Azure SQL database, but with different SQL users (they have both...

Blog Post

From the SQL Server Central Blogs - What’s next 4th time

Kenneth.Fisher from SQLStudies

It’s now been about two and a half months since I was given notice and decided to blog about my ... Continue reading

 

 Question of the Day

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

 

The Migration Tool to Use III

Which migration tool is suited to analyze my SQL Server instance in preparation for an upgrade and look for compatibility issues?

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

 

 

 Yesterday's Question of the Day (by tomaz.kastrun)

Using R apply

Using famous IRIS dataset, which result this APPLY function returns:

apply(iris[,1:4], 1, sum)

Answer: Returns sum of all values for each row in dataset

Explanation: APPLY is powerful function that returns a vector or array of list of values obtained by applying a function to margins of array or matrix. Margins denotes which function will be applied. For value 1 indicate rows, 2 indicates columns.

apply(X, MARGIN, FUN, …)

R code

apply(iris[,1:4], 1, sum)

The result for first column in dataset is 10.2, which corresponds to sum of 5.1 + 3.5 + 1.4 + 0.2.

   

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 - Development and T-SQL
How to calculate time difference? - Hello everyone, I have a table logs which maintains file names and date and time at which they were loaded into Sql server database table. The table looks like this: S.No Step_name File_name Date_time Minutes_difference 1 File Loaded Individual_1.xml 9-15-22 10:50 AM ? 2 File Loaded Individual_2.xml 9-15-22 11:00 AM ? 3 File Loaded Individual_3.xml […]
SQL Server 2012 - T-SQL
Tsql batch script does not stop - We have the following update script we are trying to do in batches. Currently the execution never stops running - so needed help understanding what's wrong with the logic or syntax thats missing. -Create Temp table create table #TempIFSC ( [EnrolledPaymentMethodAccountId] uniqueidentifier, [PaymentAccountId] uniqueidentifier, [ExternalSystemId] int, [EnrolledPaymentMethodAccountStatusId] int, [Extension] xml, [EnrollmentAccountRevisionId] int, [BankName] NVARCHAR(100) NULL, […]
SQL Server 2019 - Administration
Log shipping TO Always On Availability Group? - Hi, I've been trying to find the answer on the internet but was not successful. I don't have the setup done yet (hence can't try it out) but this is basically how it's going to look like: Produktion: 2 servers - Always On Availability Group - SQL 2019 Standard Edition hence no secondary read only […]
Dynamic column result data - Hi, First of all pls don't comment on table structure. its already created we cannot change anything. I have 3 table like below. ##Invoice (which has the unique data) and ##ReInvoice (we will submit until its get fully paid. here we maintain level) and ##Payment (which has the payment history also maintain level) create table […]
host-based authentication possible? - Hi! is  host-based authentication possible? e.g. : userA is allowed to login from 192.168.80.0/24 userB is allowed to login only from 127.0.0.1 userC is allowed to login from any host    
backup practice/strategy/risks - I have a current job that does FULL backup to all my USER DBs daily and system DBs weekly.  I do not do DIFF at all.  only Log for those full recovery model. Are there any risks to this practice when it comes to restoring in case i need to. Thanks  
SQL Server 2019 - Development
a good book on SQL - Hello! Would someone please recommend a good book on SQL development? As an example, I consider "C# 10 in a Nutshell" by Joseph Ablahari a good book. Though concise, it covers lots of material.
How to get Key based on type and sub type - I Have sample data that looks like below. We have similar data like below for ton's of different keys.  for each key data will be like 5 to 6 rows based on type and sub type ; I need to get the Key from the below records where the data set contain type COLL and […]
How to change STRING_AGG to stuff xml to split feature value by pip? - I work on sql server 2019 . i can't write query below with stuff for xml . so how to change STRING_AGG to stuff xml ? query below take too much time so i need to try with stuff for xml to reduce time cost . query i try it select a.RecomendationId, cast(STRING_AGG(cast(f1.FeatureValue as varchar(300)) ,'|') WITHIN GROUP (ORDER BY f1.FeatureId ASC) as […]
Working with Oracle
Is each serializable schedule view serializable? - We are aware that conflict serializability is a valid subset of view serializability in DBMS Schedules of Transactions. However, all serializable schedules may be included in view serializable schedules. A suitable subset of view serializability, maybe, or another option? Has this been examined?
General Cloud Computing Questions
Suggest cloud provider for SQL - I am a MERN stack developer and we need to work with SQL for a project. Can anyone suggest a good FREE cloud SQL server having low storage with which my Node backend can connect using an URI (Like Atlas for MongoDB). Our backend developer is left in the dark with this sudden and urgent […]
Reporting Services
Exporting user names and passwords - We are in the process of moving SSRS 2104 web servers in a scale out deployment from one domain to another. The unfortunate thing is that the production environment is not even close to the lower environments, mainly because of some really bad practices that I inherited and subsequently stopped from happening.  So, we were […]
General
script task and excel format syntax - Hello, I'm a newbie to script tasks and new some assistance. When using SSIS/script task, I have the following code which creates excel files in xls format. However, I would like to create them in xlsx format - what do I need to change in the code. Thank you.   Public Sub Main() Dim url, […]
Integration Services
Use ForEachLoop to split data by unique field in source and create an excel file - Hello, I'm trying to create excel files that hold data for each Invoice Id by using a Foreach Loop Container (FLC). I have successfully created the source query that lists all the distinct invoice Id's with results held in a variable (Result Set). Then successfully configured FLC to be a Foreach ADO enumerator and picking […]
Administration
EventID - 833 - Hi, We have Sql server 2005. User databases are in one drive and system databases are in C:/ drive. We are gettting alerts about Event ID: 833 from both user databases and system databases? Is surely indicate IO issues?
 

 

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

 

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