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

Daily Coping Tip

Find joy in tackling something that you have put off

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.

Good Enough

I find that many of us that work in technology want a solution to be great. Often perfect. Computers are so good at following instructions that we expect them to work as we intend all the time. We aim for being perfect in our code and we find “good enough” to be a low bar.

I think this is because many times something barely works and gets deployed because it’s good enough. Maybe the code can’t handle a load or corner cases and that’s caused us some sort of stress of pain. So we don’t want good enough. because we've been burned in the past, either by our code or someone else's.

However, good enough means to me that it is good enough for most situations. It’s not leaving something unfinished or undone, but finishing something that works well. I often tackle chores in this manner, usually because of time crunches. I consider the performance impacts, but in a realistic sense. Not all of my code will be accessed by thousands of users trying to process millions of rows. There are plenty of systems where we know the code will be thousands of rows and dozens of users. We should write the best code we can, and spend time improving our coding skills over time, but we don't need to over-engineer code too early.

At the same time, we should not be satisfied with code that we think will not meet the needs of our customers. Whether in function or performance. Sometimes we make quick decisions, knowing we will need to rework the code. In that case, we need to allocate time, file a bug ourselves, or something else to ensure we revisit this code. That has been the case often with some administrative code that I need to run today, but I know this will need to be run regularly over time. I might shortcut code with a cursor or loop, but plan on finding a better solution that performs better and is more robust. If can be automated, includes error handling,, logging, and more.

Life is a series of trade-offs. I rarely get something done as perfectly as I'd like, but that doesn't stop me from trying to be better over time. I can chase perfection, especially in code. If I regularly learn and change how I code, I find that my "good enough" becomes better and better every month.

Steve Jones - SSC Editor

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

 
 Featured Contents
SQLServerCentral Article

Assert Transformations in Azure Data Factory

arindamxs from SQLServerCentral

This article will show how you can use Azure Data Factory to check your data quality with an assertion.

External Article

DevOps 101 Webinar: Key Concepts and Terminologies

Additional Articles from Redgate

As you embark on your own Database DevOps journey you are going to hear many new concepts and phrases, but what do they mean and why are they important to consider? Join Grant Fritchey live as he breaks down the key concepts and terminologies around Database DevOps.

External Article

Raising Exceptions and Error Handling with SQL Server THROW

Additional Articles from MSSQLTips.com

Learn how and why to use THROW in your SQL Server code to be able to better handle errors that may occur during code execution.

Blog Post

From the SQL Server Central Blogs - How to use Azure Site Recovery (ASR) to replicate a Windows Server Failover Cluster (WSFC) that uses SIOS DataKeeper for cluster storage

david.bermingham from Clustering for Mere Mortals

Intro So you have built a SQL Server Failover Cluster Instance (FCI), or maybe an SAP ASCS/ERS cluster in Azure. Each node of the cluster resides in a different...

Blog Post

From the SQL Server Central Blogs - Comments in your generated code : T-SQL Tuesday #155

Kenneth.Fisher from SQLStudies

The ever amazing Steve Jones (blog|twitter) is our host this month. And in case you didn’t know he also is ... Continue reading

 

 Question of the Day

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

 

The Delete Order

I create a table, dbo.car, with an identity column in it. I add 7 rows to this table with various inserts. I then want to execute this statement:
DELETE TOP(1) FROM dbo.car
Which row is deleted?

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)

Necessary Insert Columns

I have built this table in a database:

CREATE TABLE Car
( CarID            INT         NOT NULL IDENTITY(1, 1)
, CarMake          VARCHAR(50) NOT NULL
, CarModel         VARCHAR(50)
, AvailableForSale BIT         NOT NULL DEFAULT 1
, Options          VARCHAR(20) NOT NULL
, Color            VARCHAR(20));
GO

I want to insert a row into this table. How many columns must I specify in the insert statement?

Answer: 2

Explanation: In this table, there are 4 fields that are NOT NULL, meaning they must have values. However, the identity and the AvailableForSale can be populated automatically, so only 2 are required. Ref: INSERT - https://learn.microsoft.com/en-us/sql/t-sql/statements/insert-transact-sql?view=sql-server-ver16

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 - Administration
Multi-Site Cluster with cloud File Share Witness - What happens? - Could someone advise on the following design? We have a 2-node cluster, Windows 2012, sitting in different Data Centres and different Subnets. The 3rd vote is a File Share Witness sitting on an IAAS VM in Azure....The question recently came on the following scenario In the scenario where Node 1 was hosting a SQL AG […]
How to find an actual table for a given wait resource? - Hi all, I am in a process of creation of Extended Events for blockings and deadlocks and reading information from respective .xel files in XML format. One of returned tag values is waitresource. In my cases it comes in variety of formats: KEY: 12:72057594052870144 (ce35eeb1d081) RID: 8:1:16771856:0 OBJECT: 8L1918629878 I need to find out the […]
SQL Server 2016 - Development and T-SQL
Weird behaviour with row level security policy - Hi guys, I am trying to figure out what is wrong with this implementation. I have a table called "POSTS" with 32 thousands rows inserted. This table has a column called "OWNER" which indicates the company of the user who inserted that post. I've created a security row policy which evaluates the rows and returns […]
Some questions about improving performance of Update query in SQL - Hi all, I have a following SQL query: UPDATE Individual_TEMP SET Individual_Id = CONCAT (Record_ID,'-',Individual_Id), Ind_PK_Value_Updated =1 where Ind_PK_Value_Updated is null; Objects involved in query: Table name: Individual_TEMP Column names: Individual_Id, Record_ID, Ind_PK_Value_Updated What I am trying to do with above Update query is that I am updating value of Individual_Id of the those records […]
SQL Server 2019 - Administration
Hiding SSRS Jobs does not work - Ahoy, i have a weird/annoying problem which i cant get my head around. We have implented the following solution to hide SSRS from the Jobhistory in the Agent. But somehow this does not work for my user/login, which means i still see them in the jobhistory. When my colleagues browse it, the SSRS stuff is […]
Alwayson availblity group on dev edition vs enterprise edition - We would like to set up two test instances for test alwaysOn availability group for disaster recovery and HA. They will both in our network, but in different physical location of data center. Since it needs Enterprise edition of SQL server, my question is for this testing purpose, in order not to buy license , […]
SQL Server Transaction Log Backup Fails Intermittently backing up to Azure - Just recently we have been receiving: BackupIORequest:ReportIOError: write failure on the backup device "url" Operating System Error 12175 (failed to retieve text for this error: Reason 15105) for transaction log backups. We backup the transaction log every 5 minutes and haven't had an issue with this until now. Just to be clear we are backing […]
Linked Server With SQL Authenticated Users - I'm facing an issue that has me stumped. Server A is linked to Server B via "be made using this security context" where the ID it uses is a SQL authenticated user on Server B which we'll refer to as LinkedUser. When I set up a data connection to Server A, and pull data from […]
SQL Server 2019 - Development
SSIS Pkg Load fails w/ column value containing multiple single quotes in data - Multiple single quotes in my column's data value is causing my SSIS pkg load to fail. I extract from a SQL 2016 table and load to a flat file. These 3 column nvarchar(80) values load successfully into my flat file: TE'SHAY and: ADD'L MODEM and: * HENRY'S MARKET This 1 column  nvarchar(80) value fails loading […]
Need to generate IDs from the MAX(ID) of a CTE - WITH MAXPRedID as ( SELECT MAX(ID) + 1 AS MaxID, SystemID FROM dbo.TableA GROUP BY SystemID) SELECT a.MaxID + COUNT(B.*), b.* FROM dbo.TableB b INNER JOIN MaxPredID a ON b.SystemID = a.SystemID If my MaxID is 15001 and I have 25 rows in tableB, I need to generate the new 25 IDs for starting at […]
Invalid because it is not contained either in aggregate function - Hi In below code it is giving error - column,status is invalid in the Select Statement because it is not contained either in aggregate function or Group By clause. Create View [dbo].[View_Summary] AS SELECT Max(S.[Name]), (Select count (ID) from Receipt where Id = D.Id and Status = "Receipt") as 'Receipt', (Select count (ID) from Issued […]
Amazon AWS and other cloud vendors
How to create glue scripts using Lambda function?? - Hi, Basically, working on a project which requires dynamic generation of ETL scripts using Lambda functions. These scripts are generated based on objects which define the operations required.   Does anyone know of any way that a Lambda function could generate scripts for ETL jobs, that would be stored in an S3, ready for invocation […]
General Cloud Computing Questions
Cloud interview questions - I have an interview coming up for a Cloud engineer/support Internship program. The email said they will be asking Linux and Networking questions just to get an idea of where I am at. I am currently a third year University student and I am majoring in networking and cyber security, however I wanna smash the […]
Reporting Services
Filtering on Stored Procedure Results - Currently, I have a stored procedure that produces a dataset.  A parameter value is passed in, and this causes the stored procedure to execute for each parameter value.  What I need is for the procedure to execute once without the parameter (I already modified the SQL code to process all values in one swoop), BUT […]
Integration Services
Converting word document to PDF via SSIS? - Hi all, In my SSIS project I have a variable which consists some string data. My goal is to convert this lines of data to a pdf file. What would be the best way to achieve this? I have created a File System Task which will create a word document with name like "Log_File_2022_10_18.docx". Now […]
 

 

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

 

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