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

Happy New Year 2020

Happy New Year!

It's the start of a new decade, and hopefully a good holiday for most of you today. I've worked on New Year's Day, in fact, my first SQL Server support job was Jan 1, trying to keep a broken upgrade from Dec 31 going. Not a good start to that year for me, but it spawned an amazing career.

Today I'm taking a break, and hopefully you are as well. Let's start looking forward to the new decade tomorrow.

Steve Jones - SSC Editor

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

Redgate Database Devops
  Featured Contents
Stairway to Integration Services

SSIS Catalog Environments– Step 20 of the Stairway to Integration Services

Andy Leonard from

In this next level of the Stairway to Integration Services, we look at the SSIS catalog environments and how they help you manage your package parameters.

Upsizing the SQL ConstantCare® Database Servers

Additional Articles from Brent Ozar Unlimited Blog

If you’re looking for SQL Server news, just skip this post. Brent talks about general business & capacity planning type stuff here today.

Free eBook: Fundamentals of SQL Server 2012 Replication

Press Release from Redgate

Fundamentals of SQL Server 2012 Replication provides a hands-on introduction to SQL Server replication. The book introduces you to the technologies that make up replication, and then walks you through setting up different replication scenarios. When you've finished reading, you should be able to implement your own multi-server replication setup while following the principle of least privilege.

From the SQL Server Central Blogs - Book Review: T-SQL Window Functions by Itzik Ben-Gan

Koen Verbeeck from Koen Verbeeck

A couple of years back Itzik Ben-Gan (the T-SQL guru) wrote the book Microsoft SQL Server 2012 High-Performance T-SQL Using Window Functions. It’s has been one of my most...

From the SQL Server Central Blogs - Why Don’t People Use Columnstore Indexes?

Grant Fritchey from The Scary DBA

I saw this question on SQL Server Central the other day and had an immediate, visceral reaction. I know why. Now, before I explain my answer, please, let me...


  Question of the Day

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


Getting a Dictionary

I have run this code:
import numpy as np
import pandas as pd
I have also created this dataframe:
>>> df
  BillMonth  InvoiceAmount
0       May            300
1      June            450
2      July            600
3    August            900
I want to convert this to a dictionary and store it in a new variable, called SampleBills. In here, I want the key to be the BillMonth, and the value to be the InvoiceAmount. What code will do this?

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 End of 2019

It's the end of 2019, and I want to have a countdown on the TV for a party tonight. I've written an application and then have this code set to run during the evening.

DECLARE @midnight TIME = '00:00:00';
DECLARE @now TIME = '16:00:00';
DECLARE @diff int;
WHILE DATEDIFF(SECOND,@midnight, @now) < 0
  WAITFOR DELAY '00:00:01'
  SET @diff = DATEDIFF(SECOND, @midnight, @now)
  PRINT @now 
  SET @now = DATEADD(SECOND, 1, @now)
PRINT "Happy New Year"

I decide to test this and set now to 23:59:50, but when I run this, it never works. What should I change the WHILE loop equality test to be in order for this to work?

Answer: > 0

Explanation: When this runs, it looks at the difference between the current seconds and midnight. At midnight, seconds are 0. Until then, this counts up towards 86399. There are 86400 seconds in the day, but after 86399, this resets to 0. At 0, we get the Happy New Year. If we look at the output with >0, we see:

Happy New Year

Happy New Year everyone. Be safe and enjoy yourselves.

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 2017 - Development
Need Correct Query Code Please? Thx. merry Christmas SQL Kids - Compose a SQL query to retrieve all products with its most recent two orders? Products that haven’t been ordered should be listed  also. Use ERD below. Whats Correct Query Code?  
importing text file, bulk insert to populate table - I have to import a text file to build a table and all of the date fields currently are in integer form. It comes in three different ways. The first two are like '20191223' or '0' if there is no date. The third way in the text file is like '2170915', missing the second character. […]
Working with variable length number - please assist I have table 1 and table 2, join them on account number. the problem is that table 1 has extra zeros in the middle and while table 2 does not have extra zeros in the middle, the account number is not always of the same length. see below I need to match the […]
Hadoop for SQL Developers - Hello People I am a newbie in the field of SQL Development and have a silly query. I am doubtful about a thing that if Hadoop is easy to learn for SQL Developers. Is it essential to be aware of Hadoop if I'm totally into the field of SQL Development? How much SQL is required […]
SQL Server 2016 - Administration
Basic Availability Group in Sql Server 2016 Standard edition setup - Hi, I am trying to setup Basic Availability Group in Sql Server 2016 Standard edition SP-2-CU11 and i'm having few issues/questions:My Primary DB is encrypted with Master Key.We have built another Sql server for Always ON but no user DB yet.On Primary Sql server DB, We are taking Transaction Log Backup every hour and FULL DB every […]
Finding Auto Increment value for each table in DB - Hi, I am trying to get the max value of auto identity column with table name and column name. Below is the query I am using which GIVES me table and column name BUT NOT the MAX value. SELECT OBJECT_SCHEMA_NAME(tables.object_id, db_id()) AS SchemaName, As TableName, as ColumnName FROM sys.tables tables JOIN sys.columns columns […]
SQL Server 2016 - Development and T-SQL
Truncate or Insert data with conditions - Good day, I have two tables where A is the source and B is the destination, so what needs to be achieved, when A has no data don't truncate B when A has data truncate B and insert data from A. Need help if (select count(*) from [A]) > 0 truncate table B Insert into […]
Administration - SQL Server 2014
Offline vs Online index operation - As I know, while online index rebuilding, SQL Server virtually creates an index and then at the end it swaps the existing old index with the new created one and then finally drops the old index. I would like to know if these operation same for offline index rebuild. Will SQL Server create virtually an […]
Language conversion Japanese to English for MSSQL Server DB - Hi All, I have MSSQL Server Database  installed on windows in Japanese language. Also OS  ( windows  ) installed in Japanese language. I am as English user not able to any administration on MSSQL Server Database. So Can any one please let me know how I can change the MSSQL Server Database console language to […]
High Page File Usage - Page File Usage in one of our production database server is continuously up-to more than 200% of the total available memory. Is it a signal to add more physical memory?
Development - SQL Server 2014
Reusable Variable - hello, I know there's gotta be a way here, but I'm struggling.  Let's say I have a last name parsing sql statement (using the first few letters) but the rules are complex in the event of hyphenated names, Sr's Jr's etc...  Anyway, I have all that sorted out using SELECT CASE.  This works great, but […]
SQL Server 2012 - T-SQL
Migrating databases - error on login 4064 (cannot open default database) - Hello, I am trying to figure out how to create a script to generate Login mappings to databases. I've search a lot, plenty of cases and examples, but none seem to match my problem. Here a brief explanation: I have daily backups of databases I copy to my new server. No Logins, etc. I restore […]
Reporting Services
VS 2019 TargetServerVersions - I am trying to find out which SQL Server versions are supported in VS 2019 /SSDT for Reporting Services. We have  SQL Server 2008 R2. My Infrastructure team is building a new computer with Windows 10 and it will have VS2019 on it. Our Report Server is SQL Server 2008 R2 and I want to […]
Integration Services
Has anyone used BIML to create Memory optimized tables. - I was hoping to experiment with memory optimized tables for my staging layer to speed up the process. Googling "BIML Create Memory Optimized Table MEMORY_OPTIMIZED=ON" is not giving me nay results. This seems like it would be a common setting for a table used in a staging layer. I am using the table.GetDropAndCreateDdl() code to […]
Article Discussions by Author
Performance Tuning Using Extended Events: Part 2 - Comments posted to this topic are about the item Performance Tuning Using Extended Events: Part 2


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 This newsletter was sent to you because you signed up at
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.


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