Â
SQLServerCentral Newsletter for October 29, 2020 Problems displaying this newsletter? [View online](.
[SQL Server Central](
Featured Contents
- [Setting Rows to Odd and Even Values](
- [Create a Feedback Loop between Devs and DBA Teams with Monitoring](
- [Adding Custom Stored Procedure Templates to SQL Server Management Studio and Visual Studio 2019](
- [From the SQL Server Central Blogs - Why I am running for the PASS Board in 2020](
- [From the SQL Server Central Blogs - How do I test if a linked server works using T-SQL?](
Question of the Day
- [Funny code](
The Voice of the DBA
Â
Daily Coping Tip
Be kind to yourself today. Remember progress takes time
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.
Building Quality In
I heard someone at the [2020 DevOps Enterprise Summit]( conference say that quality needs to be built in. That's something that many, or hopefully most, of us believe. Everyone ought to do quality work and build it into their daily tasks. However, the person speaking went further and defined this in a way I like:
"Building quality in means we don't pass quality issues along to others."
That's a much better definition for me. This implies that there are effects if I don't do a good enough job. If I knowingly pass along an issue, that's a problem. I haven't done quality work. I'd likely say that if I don't bother to test or evaluate my work in some way, I'm essentially doing the same thing.
We all write poor code, or do a job poorly at times. Often this comes because of ignorance, naivety, or just a lack of skill. That's understandable, and we can forgive a person not being able or ready to do a job at the same level as a more experienced person.
However, that should be a learning and teaching moment. We don't expect continuous quality issues, certainly not of the same type. A big part of the DevOps movement, and other modern software development methodologies is learning from our mistakes. Getting better. Improving the quality of our software.
Don't just get work done. Don't just close tickets or move a sticky note. Learn to do better each time you make a mistake. Learn to write better code or implement better processes. Learn to build in quality.
Steve Jones - SSC Editor
[Join the debate, and respond to today's editorial on the forums](
Â
 Featured Contents
[Setting Rows to Odd and Even Values](
bkubicek from SQLServerCentral
A ran into a problem where I needed to set certain...
[Create a Feedback Loop between Devs and DBA Teams with Monitoring](
Additional Articles from Redgate
With remote working still encouraged around the world, there is a need to ensure that operations teams have full visibility of your estate, not just your production servers. If your engineering teams have access to secure development and testing servers, deployment issues are caught before they reach production. Find out how to keep communication flowing between DBA and development teams in this free whitepaper. Read the whitepaper here.
[Adding Custom Stored Procedure Templates to SQL Server Management Studio and Visual Studio 2019](
Additional Articles from MSSQLTips.com
In this article we look at how to build a custom stored procedure template that can be used in either SSMS or Visual Studio for all new development.
From the SQL Server Central Blogs - [Why I am running for the PASS Board in 2020](
HamishWatson from The Hybrid DBA's Blog
This blog post lists the reasons why I felt the need to run for a 2 year term.
From the SQL Server Central Blogs - [How do I test if a linked server works using T-SQL?](
Kenneth.Fisher from SQLStudies
I get that linked servers are almost as despised as the dreaded cursor or (lord save us) NOLOCK, but they ... Continue reading
Â
 Question of the Day
Today's question (by Steve Jones - SSC Editor):
Â
Funny code
I have this code in a script file that someone gave me at work.
DECLARE @List TABLE
(Number INT);
DECLARE @number INTEGER = 1234;
DECLARE @strNumber VARCHAR(8);
WHILE NOT EXISTS
(SELECT * FROM @List WHERE Number = @Number)
BEGIN
INSERT INTO @List (Number) VALUES (@Number);
SET @strNumber = @Number * @Number;
SET @strNumber
= SUBSTRING(RIGHT('00000000' + @strNumber, 8), 3, 4);
SET @number = @strNumber;
END;
SELECT * FROM @List;
What does this produce?
Think you know the answer? [Click here]( and find out if you are right.
Â
Â
 Yesterday's Question of the Day (by BTylerWhite)
How Long is the List?
I have the following list in Python:
dog_breeds = ["German Shepherd", "Bulldog", "Poodle", "Labrador Retreiver", "Golden Retriever",
"Dachshund", "Affenpinscher", "Afghan Hound", "Chihauhau", "Siberian Husky",
"Golden Retriever", "Affenpinscher"]
I need to determine how many elements exist in this dog_breeds list. How can I achieve this?
Answer: len(dog_breeds)
Explanation: We can use the len function to return the number of items belonging to an object. This function will also accept other sequences or collections as an argument. Running the following code yields 12 as our result:
len(dog_breeds)
An alternative method to achieve this would be to create a loop with a counter variable, like so:
counter = 0
for breed in dog_breeds:
counter +=1
print(counter)
References:
-
[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
[Moving DB file]( - I have Always ON setup between Server_A and Server_B (Primary server is Server_A and DR server is Server_B) I have DB called ManagementDB which has 3 Data file 2 on D drive and 1 on C drive. I need to moved Data file from C to d Drive. Since it has Always on Setup I […]
[Read-only error in Primary AG replica, but the db is not read-only]( - Hello experts, I am trying to add db permissions (read/write) on the primary replica of an AOAG setup. For some reason I am getting this error: Failed to update database "MyDB" because the database is read-only. (Microsoft SQL Server, Error: 3906) I checked the MyDB options and Database Read-Only is set to False. Does anyone […]
[identify sql backup strategies]( - how do I identify if the dbs are getting backed up (full,diff,log) without looking through sqljobs /maintenance plans etc..as they maybe getting backed up from a 3rd party tool. Any tables I can look through Â
[schedule a job in CMS]( - Is it possible to schedule a sql job in CMS ? As of now I have a query which captures data from all servers listed in CMS, but its is a manual process. Can I schedule it against multiple servers and capture that data and dump that data into a single server/db/table.(Without using powershell or […]
SQL Server 2016 - Development and T-SQL
[Dividing data equally in 4 sessions]( - Hi All I have a table which contains the transactions done by cards. Below is the table structure and sample data: create table CardTransactions(CardNo int, Transactionid int, Processed bit) Insert into CardTransactions values(1,1001,0) Insert into CardTransactions values(1,1002,0) Insert into CardTransactions values(1,1003,0) Insert into CardTransactions values(1,1004,0) Insert into CardTransactions values(1,1005,0) Insert into CardTransactions values(2,1006,0) Insert into […]
[Unique value constraint among active records]( - I have a lookup table that implements a system-generated Id for DRI purposes. The lookup table has columns defining the effective and obsolete dates of the record i.e. the period during which a lookup term is valid for business use. Normally I would create a unique index on the lookup term to ensure that it […]
Development - SQL Server 2014
[what does it mean for the following SQL Scripts]( - in a stored procedure, I found two line sql scripts "    if @@microsoftversion > 0x07320000 exec sp_MSreplraiserror 20598 " , what does it "@@microsoftversion > 0x07320000" and   "exec sp_MSreplraiserror 20598 " ? and when executing this "exec sp_MSreplraiserror 20598 ", what will be done by SQL Server ?  thanks so much!
[How to encode the following dynamical SQL scripts]( - I use one table (call first table) field's value to update another another table (call second table) field's value, but the field of the second table is not fixed, only the first three charaters we know beforehand (it is ftbid), but the other characters from the 2nd table, the other character is from CONVERT(VARCHAR(2), b.orderdate, […]
SQL Server 2012 - T-SQL
[leave entitlement and balance]( - Hi all I need your advise for the below case: I’ve a leave request system that users request leaves through it and it differentiate between working days, weekends  & holidays means it counts only the working days I’ve already two tables one for employees data like (name number title dept.) and the other table for […]
SQL Server 2019 - Administration
[Migration step-by-step from SQL Server 2014 to 2019]( - We are going to migrate all our SQL Servers from 2014 to 2019. Where I can find step-by-step guide before, during, and after migration? Besides Database Migration Assistant, I could not find any. We have 80+ databases, BLOB images, using AlwaysOn, replication, SSIS packages, SSRS reports, some 3rd-party tools. We will use backup/restore methodology, but […]
SQL Server 2019 - Development
[Textfield comparator.]( - A client would like to be able to recognize similar free-texts in a text field. So based on a field find similar texts in the same column. Result could be something like a percentual equalness. Could anybody point me towards a SQL-server geared solution. Or "search words" for Google for this. The free-texts are recipe […]
[Other methods of getting the true length of UTF8 String?]( - Something I've been playing around with lately is the UTF8 functionality in 2019, and it dawned on me that getting the "true" length a string in a UTF8 string is actually not as easy as for a "normal" varchar (and nvarchar). Let's take the following table: CREATE TABLE dbo.TestTable (VarcharString varchar(30) COLLATE Latin1_General_100_CI_AS, NvarcharString nvarchar(30) […]
Integration Services
[SSIS projects connection manager driver]( - Hi I am starting using the project deployment mode. I am using SQL server 2019 And I see when I add a connection in connection manager for a package, I cannot see the sql server native client driver any more. What connection manager type do you recommend for SQL server connections? Â Thanks
[REST API through SSIS]( - I want to call (REST) API the "GET" command and assign the return value to the variable through SSIS. Any advice. Thanks, -ak
Hardware
[Are there any free resources/ebooks to develop database design and modeling ?]( - Â I want to develop my skills in database design and modeling. I found out some books like "The data model resource book revised edition volume 1". But they are not free. Are there any books to learn these skills. Â Â
Â
Â
[RSS Feed]([Twitter](
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
Â
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -