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

Creating vs. Maintaining

If your job as a developer or DBA has been like mine, it's a constant stream of requests to change something, often without enough information and short deadlines that create a bit of stress. There's always more work to be done, and while it might be a great job, you're often trying to finish something quickly enough to get to the next thing.

In this mode, how often do you think about creating (or modifying) the thing you're working on for today vs maintaining it for tomorrow. In other words, do you consider how easily your work can be understood, is documented, is designed to allow for flexibility, and can be enhanced without many (any?) side effects, or anything else.

In other words, is it maintainable?

We often build things to solve a problem and we can be very creative. We design a solution that works well, solves a problem, and may work very efficiently. However, I know I often haven't thought about future maintenance. I haven't considered how difficult it may be to understand the context around what I put together by anyone else. Sometimes I've built things that things that were very clever, but weren't easily understood by my team or able to easily adapt to new requirements when those arise.

Often I've been looking at the problem from only a "it's this tree that's important" perspective, and forgetting that my particular thing is part of a wider system (a forest). I hadn't been considering future maintenance, which often led someone in the future (often a future-me) to tear it down and rebuild something new.

That's technical debt.

When some structure isn't maintainable, it's debt. It's a burden for the team in the future. Designing things quickly and building them within a deadline, while making them maintainable requires some knowledge, experience, and also discipline to work with the patterns, and avoiding the anti-patterns, that make code difficult. The same thing applies to managing systems. Custom jobs on every server and separate configurations make life hard. At the same time, a one-size-for-everyone approach also isn't maintainable. We need a balance of well-written solutions that solve our problems, but are easily maintainable.

Part of becoming a better engineer or admin is learning how to build maintainable things that others will continue to use for a long time, not because they have to, but because they want to because the code works well.

Steve Jones - SSC Editor

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

 
  Featured Contents
SQLServerCentral Article

Creating a Linked Server in Amazon RDS for SQL Server: A Step-by-Step Guide

Arvind Toorpu from SQLServerCentral

Linked servers in Amazon RDS for SQL Server allow seamless connectivity to remote databases for distributed queries and data integration. In this article, I guide you through the step-by-step process of creating a linked server using SQL commands, from setting up authentication to testing the connection. Learn best practices, advanced configurations, and essential considerations, including why you can't use SSMS for linked server setup in RDS. This professional guide is tailored for experienced database administrators looking to optimize cross-server operations.

Technical Article

A Practical Guide to Using Azure Key Vault in Enterprise Deployments

Additional Articles from SQLServerCentral

Key vaults define security boundaries for stored secrets. It allows you to securely store service or application credentials like passwords and access keys as secrets. All secrets in your key vault are encrypted with a software key. When you use Key Vault, you no longer need to store security information in your applications. Not having to store security information in applications eliminates the need to make this information part of the code.

Blog Post

From the SQL Server Central Blogs - Online Recording: Exploring PostgreSQL for SQL Server Developers and DBAs

Klaus Aschenbrenner from Klaus Aschenbrenner

On January 9 I have done an online presentation about Exploring PostgreSQL for the SQL Server Developers and DBAs for the Cloud Data Driven User Group. You can find the...

Blog Post

From the SQL Server Central Blogs - Setting up a Local LLM

Steve Jones - SSC Editor from The Voice of the DBA

I wanted to experiment a bit with an LLM and training it, so I decided to try a few things. I looked at a few tutorials (see the references...

Microsoft Power BI Quickstart Guide cover

Microsoft Power BI Quick Start Guide: The ultimate beginner's guide to data modeling, visualization, digital storytelling, and more, 3rd Edition

Site Owners from SQLServerCentral

Bring your data to life with this accessible yet fast-paced introduction to Power BI, now in color.

 

  Question of the Day

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

 

Dates and Languages

The string, listopad, translates to a month name in different languages. If I were to run this code, what values are returned?
DECLARE @yourInputDate NVARCHAR(32) = '28 listopad 2018'; SET LANGUAGE Polish; SELECT CONVERT(DATE, @yourInputDate) AS [SL_Polish]; SET LANGUAGE Croatian; SELECT CONVERT(DATE, @yourInputDate) AS [SL_Croatian]; SET LANGUAGE English;

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)

The AG Synchronous Replicas

In a SQL Server 2022 Enterprise Edition AG, how many replicas can be configured with synchronous commit mode?

Answer: 5

Explanation: Up to 5 of your replicas can run under the synchronous commit mode. Ref: Restrictions for AGs - https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/prereqs-restrictions-recommendations-always-on-availability?view=sql-server-ver16#PrerequisitesForAGs

Discuss this question and answer on the forums

 

Featured Script

T-SQL Script for Monitoring Database Size in SQL Server

hamletshahnazaryan from SQLServerCentral

This T-SQL script helps you monitor the size and status of all databases on your SQL Server instance, providing insights into space usage and performance.

-- Script to monitor database size in SQL Server
SELECT
name AS DatabaseName, -- Name of the database
SUM(size) * 8 / 1024 AS SizeInMB, -- Total size in MB
state_desc AS Status -- Current status of the database
FROM sys.master_files
GROUP BY name, state_desc
ORDER BY SizeInMB DESC; -- Largest databases first

More »

 

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 - Administration
SQL Clustered Resource in online pending for about 3-5 mins before coming online - Hello! SQL Clustered resource used to come online during manual or automatic failover in less than a minute but now it is taking about 3-5 mins. What could be causing it? Thanks in advance.    
SQL Server 2016 - Development and T-SQL
trying to call powershell from TSQL statement - Hello, trying to call a powershell file I created, locally on the server, but also, made sure since this has an always on cluster, to first check if its PRIMARY, BUT, what i am having trouble with, is using the xp_cmdshell command... when i run the following: EXEC xp_cmdshell 'powershell.exe -File E:\folder\RunToExport.ps1' it gives the […]
SQL Server 2019 - Administration
File date from Extended Event .xel files - I know this, but I do not remember it. I have scoured by saved scripts as well a lot of google-fu. I have multiple extended event files. Activity_0_133820397244150000.xel Activity_0_133820364382140000.xel Activity_0_133820332071900000.xel This portion of the file name is a representation of the date and time, correct??? 133820397244150000 133820364382140000 133820332071900000 How can I calculate this????
restore db as db_copy. resolve hardcoded references within procedures to db. - So I backup & restore db as db_copy. within both there is a proc that does: update [db]..[column] I need it to say: update [db_copy]..[column] (Simplified, above x 1000) Is there a step in backup / restore to do this?  Is there a quick resolution?  Is this poor coding in the first place?   Thank […]
PK violation in replication but only one subscriber - We have a publication with three subscribers; it's basically a part list with around 1.2 million rows.  The local table is on a SQL Server 2019 instance, and is updated nightly via a MERGE statement from a larger part list.  This table and several smaller ones are replicated via Transactional Replication to three different Azure […]
SQL Server 2019 - Development
Final SELECT with WHERE based on passing in variable from Dropdown box - Is there a way to base the final select statement based on whether a user chooses, from a report dropdown box, a date range based on e.g.: PaidDate or DateOfService similar to the below (which doesn't work): SELECT CASE WHEN @dateChoice = 'DOS' THEN ( SELECT DISTINCT tp.client_id AS Member_ID ,tp.PaidDate AS Paid_Date ,tp.DOS FROM […]
AD, powershell and ssis - Hi, i have a requirement that involves visiting multiple folders in AD for active, disabled etc computers.   Other attributes  might need to be extracted as well including associated users and locations.   From what im seeing in AD,  at least sometimes the description column here has the user name.  And the folder can be the location.  […]
Generate number fields - Hi all, I hope someone can help with advice. What would be the best approach to create an output for the below scenario. If I have a table with an assessment code and description and I would then like to populate every occurence of assesementcode / description with a mark system of say 1 to […]
do i need a driver for mysql? - hi we'll want to communicate with a mysql server at one of our locations from our sql dw server for warehouse extracts daily. i thought i saw everything from oracle sources to sql sources to oracle's netsuite as a source to native sql drivers etc etc but do not believe i've ever seen a sql […]
SQL Server 2022 - Administration
DbDefence - how does work this tool? - How it is implemented?  I have installed, tried, it is free for dbs <=30 mb. I have asked their support: MS declared XP's are legacy and do not use them, they will be removed in the future versions. It was written some versions ago. What you will do? But DbDefence support answered: MS wrote but […]
SSMS gets very messy - At work we have quite a few databases that I'm frequently browsing. This is quickly becoming a real mess when I need to switch between different SSMS'es (I need to start them with different credentials) and different databases. My questions is, do you guys have any hints to make working with lots of databases/tables within […]
Recovery Takes 10-20 mins with ADR enabled - Hi Experts, I have database about 300GB in size with ADR enabled but after every failover\restart it takes about 10-20 minutes to come online. The database have multiple files and the tables are all partitioned. Can anyone shed some light on this ?   CREATE DATABASE [LogsDB] CONTAINMENT = NONE ON PRIMARY ( NAME = […]
SQL Server 2022 - Development
Transpose sql table rows into columns - I want to transpose sql table rows to columns. I have written a query for that already but its taking a very long time (around 15 min) as the number of rows in the table is high like 8M+. Is there any other way to write the query to get the same output with improved […]
Volunteering SQL Server Skills - Can anyone please recommend where one can volunteer SQL Server skills to gain experience in other technologies? For example, for charities or voluntary organisations, to gain experience in using PostgreSQL, MySQL, Azure or other database technologies around SQL Server? How can one find such voluntary organisations or charities that are looking for people to donate […]
Problem with the dll (version 1.2) of an Extended Stored Procedure with SQL Serv - SQL Server 2022 16.0.4165.4 Windows Server 2022 Datacenter 21H2 20348.2849 Our Extended Stored Procedure works 95% but it occasionally generates overflow errors (BEX64) in the Windows event log. In the Event Viewer we have an Information Event 1001 from Windows Error Reporting (Event name BEX64  and SQLException64). What's strange is that this indicates that there […]
 

 

RSS FeedTwitter

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

 

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