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

Patching the Patch

I had to make a few changes to a SQL Saturday event recently. Some of the organizers submit PRs for their changes, and others send me an email/message/text/etc. for a change. In this case, an organizer just asked for a couple of image updates to their site. I opened VS Code, created a branch, added a URL for the images, and submitted my own PR. After the build, I deployed it.

And it didn't work.

I had a broken image. I checked the URL in code and realized I had "events" and the Explorer window where I'd copied the files was "event". Repeat, new PR, build, merge, deploy.

And it didn't work.

I was looking at the code for the site, the code in the repo and trying to reconcile paths and file names and keys and values and a few other things.

I realized the world for a developer hadn't changed a lot, and in fact, I was in the age-old loop: deploy, patch, patch the patch, fix the patch for the patch, and so on. I don't even know that I could have gotten better here with testing, as these were one-off data changes that affected the site for users. If I enter the wrong data, it's wrong. I can't easily test for this.

I have written code that was wrong, and a few simple tests would have caught my issues. I've also written code that isn't easy to test. If I am adding or changing data, it's hard to test that. Often, I might do some copy/pasting between the code and the test to generate the test. If I've typo'd something, the typo continues through the test (in some cases). Even using a code generator or an AI to produce the INSERT or UPDATE code might not solve the problem. They might read my typos in a prompt.

One of the best things to help code quality in the last few decades is continuous integration (CI), where we have automated systems that compile code, test it, and run it. It's not perfect, but it does help reduce the silly mistakes many of us likely make every day when writing code. These can't prevent typos and issues, but if we are testing intermediate systems, hopefully somewhere along the way, a human or AI agent tries to verify that the things we were typing exist and can catch a typo.

Working with data is hard, and it's a constant source of simple mistakes. I don't know we'll ever get away from patching the patch when data manipulation is involved.

Steve Jones - SSC Editor

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

 
  Featured Contents
SQLServerCentral Article

How to process images and analyze charts with AI

Daniel Calbimonte from SQLServerCentral

See how ChatGPT can get data from images and conduct analysis on the data.

External Article

What are the Key DevOps Performance Metrics You Should Track?

Additional Articles from SimpleTalk

Successful DevOps teams rely on data-driven decision-making to continuously improve software delivery and operational performance. Understanding the right DevOps performance metrics is crucial for identifying bottlenecks, improving efficiency, and maintaining high availability. Metrics provide insight into how well your team deploys software, how quickly issues are resolved, and how stable the production environment remains over time.

Blog Post

From the SQL Server Central Blogs - Invoking Another Pipeline in Microsoft Fabric

Meagan Longoria from Data Savvy

At the moment there are two activities in Fabric pipelines that allow you to execute a “child” pipeline. They are both named “Invoke Pipeline” but are differentiated by the...

Blog Post

From the SQL Server Central Blogs - Getting Started with Vector Search in SQL Server 2025 Using Ollama

aen from Anthony Nocentino Blog

Ollama SQL FastStart streamlines the deployment of SQL Server 2025 with integrated AI capabilities through a comprehensive Docker-based solution. This project delivers a production-ready environment combining SQL Server 2025,...

Pro SQL Server 2022 Wait Statistics: A Practical Guide to Analyzing Performance in SQL Server and Azure SQL Database

Site Owners from SQLServerCentral

Use this practical guide to analyze and troubleshoot SQL Server performance using wait statistics. You'll learn to identify precisely why your queries are running slowly. And you'll know how to measure the amount of time consumed by each bottleneck so you can focus attention on making the largest improvements first. This edition is updated to cover analysis of wait statistics current with SQL Server 2022. Whether you are new to wait statistics, or already familiar with them, this book provides a deeper understanding on how wait statistics are generated and what they mean for your SQL Server instance’s performance. 

 

  Question of the Day

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

 

How Many Can Be the Greatest

I am trying to analyze a number of columns in a large table to determine the highest value for each row. In SQL Server 2022, we have the GREATEST function, which will return the greatest value from those columns passed in. How many columns can I include in an expression like this:
select GREATEST( col1, col2, col3, ...)

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)

Generating a Series I

What is returned by this code in SQL Server 2022?

SELECT value FROM GENERATE_SERIES(4, 1);

Answer: 4 numbers, starting with 4 and decrementing to 1

Explanation: The GENERATE_SERIES function takes a start and stop arguments. If stop is greater than start, the series decrements by 1 as a default. Ref: GENERATE_SERIES() - https://learn.microsoft.com/en-us/sql/t-sql/functions/generate-series-transact-sql?view=sql-server-ver17

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
Insert bulk fails when Online Index Rebuild is done - Hi, We are getting issue of Insert bulk failed due to schema change of target table. We had created a job to check if fragmentation of table > 30% then to rebuild index online whilst bulk insert is happening in that table. We have around 3 transaction tables in which bulk insert happens and at […]
SQL Server 2019 - Administration
Urgent, Please Help. Named Instance Question - Hello all, I just installed a new named instance on SQL Server 2019 RTM-CU32.  The installation was successful but when I connected to the new named instance, it had all the databases and data from the default instance.  I looked at the properties of a couple databases and both instances (default and named) point to […]
Best/easiest way to import an SSIS package... - Folks, Looking for advice on the best way to import a package. I hope I'm in the right location! Apologies if I'm not. I inherited a system (Sql Server 2019) with an existing SSIS package. The installation notes indicate that you have to be on the server using SSMS v18. The installation notes indicate: 1. […]
balancing numa nodes - Can anybody advise on how i go about balancing threads to each node. As you can see from the below screen shot node_id 2 & 3 and 6 & 7 are offline (another query i ran shows them as OFFLINE VISIBLE). This is sql2019 STANDARD so limited to 48 online schedulers which are currently spread […]
Question about updating statistics - We have very large tables in our database, some even more 1 B records, so updating statistics will take many hours. Would it be a good idea to skip those tables that have ratio of modified records to total number of records less than 0.5 percent? That's because number of buckets in statistics histogram is […]
SQL Server 2019 - Development
SSIS raw file conversion - Hi, Does anyone know how to handle a raw data file where some rows contain carriage return characters? The problem is that certain rows, which should be treated as a single line, are being split into multiple lines due to embedded carriage returns in the file. The file was exported using isql from Sybase, not […]
Error converting data type varchar to float - Hi everyone I have a bunch of CSV files that I need to import into SS using BULK INSERT.  One file works fine.  The other fails.  Both have the same setup...there is one column that has no data in it so there is only a column header.  I used the logic from the CSV file […]
How to convert this to datetime format? - hi everyone I have a CSV that is storing date as "20180919T201400+0000".  I am using BULK INSERT to import the file.  How do I convert varchar "20180919T201400+0000" to a datetime format that SS can understand? My attempt: CONVERT(VARCHAR(25),REPLACE(ANNOUNCE_DATETIME,'"',''),126) AS ANNOUNCE_DATETIME Error: Conversion failed when converting date and/or time from character string. Thank you
telephones and sql - hi im pretty sure i could trigger a page on a pager if i had to from t-sql. but triggering a phone call doesnt appear to be as easy.   does the community know for sure?   perhaps of an approach that doesnt require i bring python , 3rd party software , maybe clr etc into the […]
Problem with CASE statement - Hi Everyone I have used CASE many times but not sure what I am doing wrong here.  SS won't accept it.  What am I doing wrong?  How can I fix it? SQL ALTER PROCEDURE [dbo].[WIP_UpdateEvents] (@FILENAME varchar(200), @RECORD_ADD_DATE datetime) AS DECLARE @FILEPATH VARCHAR(200) SET @FILEPATH = @FILENAME DECLARE @RECORD_ADD_DT varchar(26) SET @RECORD_ADD_DT = convert(varchar(26),@RECORD_ADD_DATE,121) DROP […]
Strategies and Ideas
Measure duplicating its value when non-conformed dimension attribute is included - Hi,   I have two fact tables (say FactA, and FactB), that are joined/shared by three dimensions (dimA/B/C) in-between the two fact tables (conformed dimensions). Fact A contains a list of finance agreements. FactB contains budgeted sales figures, so we have a figure for each month, for each product, for each sales channel. There is […]
T-SQL
T-SQL - except - add date column - SELECT         [A]       --,[Date]       ,       ,[C]       ,[D]       ,[E]          FROM [Database].[dbo].[Table]   where B < 1000     AND   (CheckDate >= getdate()-4 AND      CheckDate < getdate()) EXCEPT   SELECT        [A]   […]
T-SQL - except - add date column - .
SQL Server 2022 - Administration
Force Strict Encryption - SQL Agent fails - Hi, On my SQL 2022 (16.0.4195.2) test environment, I tried to enable Force Strict Encryption. To do this: - I generated a certificate using ps script :    $newCertificate = New-SelfSignedCertificate -CertStoreLocation cert:\LocalMachine\My -DnsName "DEV-SERVER.domain.local","DEV-SERVER" -FriendlyName "Cert_Test" -KeySpec KeyExchange -Provider "Microsoft RSA SChannel    Cryptographic Provider" -TextExtension "2.5.29.37={text}1.3.6.1.5.5.7.3.1" # Convert the report server password to […]
SQL Server 2022 - Development
High Availability Reversed - Force secondary unless failure - Hi I have sql2022 in H/A with a primary and a secondary server. My problem is that I have a query that I need to force it to run the secondary. But I need to point to the listener in case of failover, which is always pointed at the primary. Is there any kinda of […]
 

 

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

 

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