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

Working in Smaller Teams

I don't know what the average size of a team is, but I know I've worked in all sizes in my career. I've had teams of 1-3, which is common in database work, but I've also been on a 20 person Ops team. I've been in 2 person development teams, 25 person teams, and everything in between. At Redgate, it seems most of our development teams are less than 10 people, but I'm sure we've exceeded that at times.
 
I do think smaller teams are better, and they are certainly easier to keep track of what everyone else is doing. Once a team becomes large, even with regular status reports or meetings, there is too much information to easily hold in one's memory about tasks other than our own. Knowing what others are working on can be invaluable in coordinating and avoiding conflicts. This also ensures that the team can more easily ensure code is written in a similar fashion and knowledge is easily shared.
 
There is research that seems to indicate that smaller teams are better. This article talks about some of the reasons small teams seem to perform better. These all seem to intuitively make sense to me, and I've certainly experienced people behaving in these manners. In the second piece, there is advice on how to get teams to be more effective. The biggest advice seems to be a lot of what we do at Redgate. We empower teams, give them tools, and don't manage them in traditional ways. We hold them accountable to get work done and meet goals, and we challenge them, but we want them to move forward, not work in a particular way.
 
Building a team is hard, and getting a team to perform at a high level is very hard. I do think that the internal talent and motivations of individuals can make a big difference, but I also think that management can bring out the best in people, or it can ensure you never get anywhere near the potential of team and encourage under-performance.
 
It constantly surprises me how often I find managers and their organizational culture built to control and not inspire employees to do their best. I think it's a holdover of years of working a certain way, rather than supporting and encouraging each person supervising others to get the best from others. I hope this changes, but it's certainly something I try to detect in interviews before I ever commit to a new position.
 

Steve Jones - SSC Editor

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

Redgate Database Devops
 
  Featured Contents

Best WordPress Security Practices for 2020

anastasia.stefanuk from SQLServerCentral

Since many of you choose to host a blog on Wordpress, here are a few things to think about when securing your site. Some of these might also be things you check for your other applications accessing SQL Server.

New Redgate University Courses to Advance your Skills

Additional Articles from Redgate

You may have seen our getting started courses which show you the fundamentals of your Redgate tools. If you are already up to speed and using the tools then you may want to revisit the site as we have added some exciting new courses for SQL Change Automation and SQL Test. These courses aim to give you tips, tricks and ideas on how to utilize your tools to their full potential.

PowerShell and Secure Strings

Additional Articles from SimpleTalk

Greg Moore demonstrates how to work with the Get-Credential PowerShell cmdlet and secure strings when authenticating to an SFTP server.

From the SQL Server Central Blogs - Using Powershell for SQL Saturday Logos

John Morehouse from John Morehouse | Sqlrus.com

Out of necessity are born the tools of laziness.  This is a good thing.  I have found that organizing and running a SQL Saturday event is a great way...

From the SQL Server Central Blogs - DMV with SQL Server Service info (including the service accounts)

Kenneth.Fisher from SQLStudies

I recently found this DMV and couldn’t wait to share. sys.dm_server_services What’s so great about it? For each service for ... Continue reading

 

  Question of the Day

Today's question (by Carlo Romagnano):

 

Create temporary table on fly

I run the following code:
select col1 = 1/0.000 
into #a 
WHERE 0=0
What happens?  

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)

Printing the String

I am trying to debug a T-SQL script and want to return some information to the messages tab in SSMS. I decide to use the PRINT statement. I have a static message, but I want to include the name of the user in the middle of it.  Right now I have:

PRINT 'This action was initiated by  and it failed.'

I want to insert the user name between the "by" and "and". How should I edit my code?

 

Answer: Change the code to: PRINT 'This action was initiated by ' + USER_NAME() + ' and it failed.'

Explanation: The easiest way to do this is insert the user name in the middle of the string with the concatenate operators. Ref: PRINT - https://docs.microsoft.com/en-us/sql/t-sql/language-elements/print-transact-sql?view=sql-server-2017

Discuss this question and answer on the forums

 

Featured Script

Compare data of two tables

S_Kumar_S from SQLServerCentral

Script to facilitate the comparison of data between two SQL Server tables

/****** Object: StoredProcedure [dbo].[usp_CompareTable] Script Date: 08-30-2019 00:59:18 ******/
-- =======================================================================================================================================================
-- Purpose : This stored procedure will compare data of two tables.
-- No. of Parameter : 6
-- @db1 : First Database Name
-- @Tb1 : Table Name of First Database
-- @db2 : Second Database Name
-- @Tb2 : Table Name of Second Database
-- @Matching Key: Matching Keys
-- @TopN : No. of records you want to display after comparision
-- =======================================================================================================================================================
SET ANSI_NULLS ON;
GO

SET QUOTED_IDENTIFIER ON;
GO

SET ANSI_WARNINGS OFF;
GO

ALTER PROCEDURE dbo.usp_CompareTable
( @Db1 VARCHAR(100),
@Tb1 VARCHAR(100),
@Db2 VARCHAR(100),
@Tb2 VARCHAR(100),
@MatchingKey VARCHAR(500),
@TopN INT = NULL)
AS
BEGIN
DECLARE @JoinCondition VARCHAR(MAX) = '';
DECLARE @i INT = 0;
DECLARE @as VARCHAR(200);
SELECT
value,
rnm = ROW_NUMBER() OVER (ORDER BY value)
INTO #ColumnList
FROM STRING_SPLIT(@MatchingKey, ',');
SELECT @i = COUNT(1) FROM #ColumnList;
WHILE @i > 0
BEGIN

--Prepare JOIN condition
SELECT
@JoinCondition
= @JoinCondition + ' A' + '.' + value + '=' + ' B' + '.' + value
FROM #ColumnList
WHERE rnm = @i;
SET @i = @i - 1;
IF @i <> 0
SET @JoinCondition = @JoinCondition + ' AND ';
END;

--Prepare CASE condition
DECLARE @CaseCondition VARCHAR(MAX);
CREATE TABLE #cases
(CaseFromSelect VARCHAR(MAX));
INSERT INTO
#cases
EXEC ('SELECT ''CASE WHEN A.''+A.COLUMN_NAME+'' <> B.''+B.COLUMN_NAME+'' THEN ''''''+A.COLUMN_NAME+

''''''''+'' ELSE '''''''' END '' +A.COLUMN_NAME

FROM ' + @Db1 + '.INFORMATION_SCHEMA.COLUMNS A INNER JOIN ' + @Db2 + '.INFORMATION_SCHEMA.COLUMNS B

ON A.COLUMN_NAME=B.COLUMN_NAME WHERE A.Table_name =''' + @Tb1 + ''' and A.Table_catalog=''' + @Db1 + ''' AND B.table_name =''' + @Tb2 + ''' AND B.Table_catalog=''' + @Db2 + '''');
SET @CaseCondition = '';
SELECT @CaseCondition = @CaseCondition + CaseFromSelect + ', ' FROM #cases;
SELECT @CaseCondition = SUBSTRING(@CaseCondition, 0, LEN(@CaseCondition));
EXEC ('SELECT ' + @CaseCondition + ' INTO ##T123 FROM ' + @Db1 + '..' + @Tb1 + ' A ' + ' INNER JOIN ' + @Db2 + '..' + @Tb2 + ' B ' + ' ON ' + @JoinCondition);
CREATE TABLE #Mismatchingcolumns
(Columnlist VARCHAR(5000));
DECLARE @s VARCHAR(MAX) = '';
SELECT @s = @s + 'SELECT ' + COLUMN_NAME + ' FROM ##t123 UNION '
FROM tempdb.INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = '##T123';
SELECT @s = SUBSTRING(@s, 1, LEN(@s) - 6);
INSERT INTO #Mismatchingcolumns EXEC (@s);
UPDATE #Mismatchingcolumns
SET Columnlist = ' A ' + '.' + Columnlist + ' , ' + ' B ' + '.' + Columnlist
WHERE Columnlist <> '';
DECLARE @Clist VARCHAR(MAX) = '';
SELECT @Clist = @Clist + (Columnlist) + ', '
FROM #Mismatchingcolumns
WHERE Columnlist <> '';
SELECT @Clist = SUBSTRING(@Clist, 0, LEN(@Clist));
IF
(
SELECT COUNT(*) FROM #Mismatchingcolumns WHERE Columnlist <> ''
) = 0
SELECT 'All data identical';
ELSE
BEGIN
IF @TopN IS NULL
SET @TopN = 999999999;
DECLARE @FinalQuery VARCHAR(MAX) = '';
SET @FinalQuery
= 'SELECT TOP ' + CAST(@TopN AS VARCHAR(10)) + ' ' + @Clist + ' FROM ' + @Db1
+ '..' + @Tb1 + ' A ' + ' INNER JOIN ' + @Db2 + '..' + @Tb2 + ' B '
+ ' ON ' + @JoinCondition;
EXEC (@FinalQuery);
END;
DROP TABLE ##T123;
DROP TABLE #Mismatchingcolumns;
END;

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 2017 - Administration
Restoring from a backup - Hi, I am trying to put a 2012 database on a new 2017 server. So, I thought that the easiest way would be to take the backup that I have for 2012 and restore it to 2017. However, it would not go. I tried just restoring it, and then made an empty database with the […]
Seed AG Primary and Secondary with Log Shipping - I am planning a SQL Server migration from 2008/08R2 up to SQL Server 2017 Availability Group. I have 3 08/08R2 stand-alone instances that I'm migrating.  Can I use log shipping on SRV1  running 2008 to secondaries like SRV2 and SRV3 that are running SQL Server 2017 and then establish an AG on SRV2/3 with those […]
SQL Server 2016 - Administration
Primary server stay on resolving state- Always ON - Hi All , In my case we’re Looking the cause why in our Always On SQL when we lost communication on the secondary replica the primary goes down (stay on the Resolving state) Any thoughts please Thank you  
fail over database in high availability - Always On - Hi All, Currently we have configured Always on - High Availability in our SQL servers. We need to fail over per database not per Availability group because in 1 availability group we have multiple databases. How do I fail over 1 database in Always on environment ? Any feedback is much appreciated    
SQL Server 2016 - Development and T-SQL
select several lines randomly according to several categories - Hello, I have the following dataset: Family Room subfamily 1            5               6 2            5               7 3             5              7 4        […]
Rownumber() - I need to get a rolling count only of rows matching a particular criteria and to use the result in a concatenated output field. The remaining rows (those not matching the criteria) do not need to be counted as they will have a different output field. For example... Row 1 - Matches criteria so count […]
Administration - SQL Server 2014
GDR update of SQL Server 2014 for x64-based - Hi, I got a vulnerability that requires me to install a patch on my SQL Server 2014, I downloaded the patch: "SQLServer2014-KB2977315-x64-ENU" but I'm failing to install it, it only get to "Select Features", but it doesn't show any Features to select, and I can't go further than that. Please help.
SQL Server 2012 - T-SQL
Trying to create Nested SUM OVER Function for backwards running total. - Here is sample code from my running total, now I need to reverse it and add a where exists clause to subtract rather than add from the initial value (in this case enrolled students from day 1). I need to add some sort of where clause or update for endDates to show drop offs from […]
SQL Server 2008 - General
2nd Server min requirements for transaction log shipping & reducing license cost - I will have a 64-bit 2008 R2 SQL Server Standard edition acting as the production (primary) database server in a vSphere environment. I was planning on creating a secondary server that mirrors the Operating system environment and SQL server configuration, which is where the primary databases transactional logs will be shipped and applied. Since this […]
SQL Azure - Administration
How to move PROD SQL Azure Singleton database from one subscription to another? - We have our production database (Azure Singleton) up and running in Azure. Due to a few security vulnerabilities found, we were asked to move that into a new subscription. The size of the database is about 200 GB. Obviously we need to move our current production database to the new subscription. Before that we would […]
Reporting Services 2008/R2 Administration
Reverting from custom authentication - We have an asp.net application that using forms authentication to embed SSRS into the website.  Long story, but the encryption keys were deleted and now the forms authentication no longer works.  We are waiting on the developer who did this to be engaged, but I'd like to revert the custom forms authentication back to straight […]
SSRS 2016
Copy or Move Shapshot Reports - Hi We have snapshots on an old report that we would like to move to a new report in Report Manager. Is there anyway to move these reports? Thanks in advance
Repeat Header and rows on each page doesn't Work please help :( - Hello, just like the header states, SSRS wont let me print the header on each page, it would be nice but cant, i check the box, made sure its checked on the Table properties... I just want it to print my Table header info on each page... didn't know it was going to be this […]
Integration Services
how to hide the passsword in the log file when the package fails. - I have an encryption and decryption package and the keyId public and private from GPG coming from config file of package. for testing purpose provided incorrect key id in the config file that will fail the package as gpg didn't find the local key and in the log file captured complete command with passphrase too. […]
Backups
SQL Server Restore precheck gets free space wrong - I'm trying to move a large database (22 TB) from a stand alone server to a Storage Spaces Direct (S2D) cluster.  The database to be moved is four files, none over 16 TB.  The cluster is already hosting many TB of data and is working fine. To minimize downtime, I generally restore a full backup, […]
 

 

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

 

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