SQLServerCentral - www.sqlservercentral.com

A community of more than 1,600,000 database professionals and growing

Featured Contents

Featured Script

The Voice of the DBA

Teaching Quickly

I'm a constant learner. I try to regularly experiment and try new things at work and in the rest of my life. For work, sometimes this means working outside of the other hours and commitments I have to get better at manipulating data. Sometimes I go deep and sometimes I just want the general gist of how to solve a problem I'm having. Time constraints come into play at times because there's never enough. Even with limited time, I do want to understand the reasons why things work, or why I should make a choice for some function/method/framework/pattern/etc.

I've been working with R a bit this summer, trying to learn a bit more. I've tried tryr.codeschool.com as a guided tour, but sometimes it doesn't help me understand enough of the details. Even as I experiment, I'm going through the motions. I purchased R in a Nutshell, and just got Stephanie Locke's Working with R. I'm hoping these books will give me a more thorough grounding in R.

As I'm learning, I always want to ensure I understand the implications of how I may write scripts. What do my choices mean for quality, performance, etc. Sometimes trying to understand why slows me down, and I don't get much done. That's fine, and maybe that's for the better. However, I don't want to learn slowly by going through all the pain that someone else went through. I want to know how someone would write code today, and why they do so.

I ran across this post on learning the hard way. It discusses the way some people try to teach others, and I've been through some of this as I've tried to learn various technologies. The teacher sometimes wants to assume I am going through their pain and can sympathize, but often I'm learning something new for the first time. I'm sure I've been guilty of this as well, perhaps trying to level set or show an old (or poor) practice to emphasize why it's better to write code in a new way.

The thing is that my time is precious, and I shouldn't have to work through the mess of the way things used to work to build good habits today. What's new to someone might not be new to all, and certainly at some point, all code isn't new anymore. I'd rather teachers, and me, sometimes focus on giving us good habits today. Teach us the right way now, and spend time on error handling, testing, or other good habits. Certainly there are cases where we need to know about the changes to systems, but explain this is an upgrade section. And then tell me what's different, don't wax nostalgic on the way you once were forced to find innovative solutions.

Steve Jones from SQLServerCentral.com

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

The Voice of the DBA Podcast

Listen to the MP3 Audio ( 3.9MB) podcast or subscribe to the feed at iTunes and Libsyn. feed

The Voice of the DBA podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music.

SQL Compare

The industry standard for comparing and deploying SQL Server database schemas

Trusted by 71% of Fortune 100 companies, SQL Compare is the fastest way to compare changes, and create and deploy error-free scripts in minutes. Plus you can easily find and fix errors caused by database differences. Download your free trial

Database DevOps

How mature are your database DevOps processes?

Complete Redgate’s Database DevOps Maturity Assessment to understand how mature your processes are, how you compare against your peers, and receive recommendations for improvements. Take the assessment

Featured Contents


Making Good Use of SQL Server Auditing

John F. Tamburo from SQLServerCentral.com

SQL Server Auditing is a powerful out-of-the box toolset that captures auditing information and writes to a file or the Event Log. This article examines the little things that might snag you up. More »


The Basics of Good T-SQL Coding Style – Part 4: Performance

Additional Articles from SimpleTalk

There are several obvious problems with poor SQL Coding habits. It can make code difficult to maintain, or can confuse your team colleagues. It can make refactoring a chore or make testing difficult. The most serious problem is poor performance. You can write SQL that looks beautiful but performs sluggishly, or interferes with other threads. A busy database developer adopts good habits so as to avoid staring at execution plans. Rob Sheldon gives some examples. More »


From the SQLServerCentral Blogs - Auditing Data Access in SQL Server for GDPR Compliance

matthew.mcgiffen 73574 from SQLServerCentral Blogs

In relation to the GDPR, I’ve recently been looking at the tools available within SQL Server to support auditing our... More »


From the SQLServerCentral Blogs - Just Check ALL the Boxes

SQLEspresso from SQLServerCentral Blogs

Today I ran into something on a client server I unfortunately see too often.  The DBA goes through the trouble... More »

Question of the Day

Today's Question (by Avinash):

When columns with different datatypes are compared in SQL joins or if we assign variables of one datatype with variables of other datatype, then SQL server implicitly converts datatype based on their precedence. If value can't be converted SQL will generate data type conversion error. What will be the output datatype from this code:

    @txt VARCHAR(20),
    @dt  DATETIME,
    @i   INT,
    @bin VARBINARY(20);
SET @txt = '2017-01-01';
SET @dt = '2001-01-01';
SELECT result = @dt + @txt

Think you know the answer? Click here, and find out if you are right.

We keep track of your score to give you bragging rights against your peers.
This question is worth 1 point in this category: Data Types.

We'd love to give you credit for your own question and answer.
To submit a QOTD, simply log in to the Contribution Center.


Pro Power BI Desktop

This book shows how to deliver eye-catching Business Intelligence with Microsoft Power BI Desktop. You can now take data from virtually any source and use it to produce stunning dashboards and compelling reports that will seize your audience’s attention. Slice and dice the data with remarkable ease then add metrics and KPIs to project the insights that create your competitive advantage.

Yesterday's Question of the Day

Yesterday's Question (by Steve Jones):

I want to store Marvel data. My goal is to store a character name, a movie title, and a year of release. Which construct in R creates a data frame?

I have already set some variables:

> characters <- c('Iron Man', 'Iron Man', 'Spider-Man', 'Thor')
> movies <- c('Iron Man', 'The Avengers', 'Spider-Man', 'Thor')
> releaseyear <- c(2008, 2010, 2002, 2011)

Answer: marvel <- data.frame(characters, movies, releaseyear)


The data.frame function is used to assemble a set of rows from variable vectors, each of which needs the same number of elements.

Ref: Data Frame - click here

» Discuss this question and answer on the forums

Featured Script

Rebuild or recompile all views

Doug Deneau from SQLServerCentral.com

This is a simple little script, but may come in handy for some. During our database upgrades we always run a series of utility steps to make sure our code is in sync and functioning properly based on the revisions that have been made for each release. This script is one of those run to recompile all views to catch any "SELECT *" views, or views where the underlying schema has changed and we missed changing the view.

This can be added as one of your steps to your deployment SQL.

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 2016 : SQL Server 2016 - Administration

DBA changing role - billing for services/procurement - Hello

Seriously poor performance after upgrading to 2016.... - A database was upgraded to 2016 and certain queries (views) are exhibiting terrible performance.  On the previous server (2008 R2),...

Is this a good idea or a really, really dumb one? - We have dumped quite a bit of data into a data warehouse and starting to create reports/views/dashboards/etc. In creating particular views,...

SQL Server 2016 : SQL Server 2016 - Development and T-SQL

SSIS: Not able to rename package - Dear all, I have a problem when trying to rename a package name. I get this message even knowing that the...

Merge to upsert when target table might have legitimate duplicate tuples - Am I correct in saying that it's no use to try to use the Merge statement for an Upsert (meaning,...

select count of rows based on condition - Hi, Need to select count of rows based on codition from a table. Tried with this query , but no luck. select CASE WHEN...

SQL Server 2014 : Administration - SQL Server 2014

SQL Error Log will not open - I am running SQL Server 2014 CU5 on Server 2012 and have an issue with opening the SQL Server Error Logs. ...

Need to Change Compatibility Level of Lots of Databases - I have a SQL Server 2014 instance with quite a few databases on it.  I want to change the compatibility...

Linked servers cannot be used under impersonation without a mapping for the impersonated login - Hi all I have a stored procedure that selects data from two instances. If I run the stored procedure it works...

SQL Server 2014 : Development - SQL Server 2014

tsql help - Hi Experts, Need tsql help. I have a table row as follows. Basically, it will contain a huge string values...

Since looping is bad, how should I accomplish what I am trying to do? -

SQL Server 2012 : SQL 2012 - General

Getting the same value in last 3 or digits when using Datetime2 data type in SQL Server 2012 - I recently started to use datetime2 data type in SQL Server 2012, and found something interesting.  The time value in...

Trigger on CDC table - Hello,     I created 2 tables one in SQL server and another in PostgreSQL both named as columns (id, name)....

SSPI handshake failed with error code 0x8009030c, - Hello All, Could anyone help fixing below error? I can see this error in SQL error logs and event logs also. Message Login...

Connection Encryption - Protocols not showing the certficiate - Following https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/enable-encrypted-connections-to-the-database-engine to setup SSL connections. Have got through to the part when you need to enable the certificate in the...

Programming : Powershell

Enumerations in PoSh prior to V5 - I'm trying to create an enum of our SQL Servers Add-Type -TypeDefinition @"  public enum OurServers3      {      Srv1,      Srv1\Instance1      } "@ The backslash in the ...

Data Warehousing : Integration Services

SSIS package shows successful but not working - I have an SSIS package that was executing successfully for some time but last week started erroring.  The error on...

Data Flow Task Error: The version of ODBC Source is not compatible with this version of the DataFlow - So, that is the error I am getting when I attempt to execute my extremely simple SSIS package.  How simple?...

SQLServerCentral.com : SQLServerCentral.com Website Issues

A user you are following, "...", has posted new content: but I'm not following this user - Today I received an email A user you are following, "...", has posted new content:but I'm not following this user "Thom A", has...

SQL Server 2005 : SQL Server 2005 Integration Services

Change column order in Flat File Destination - Hi there, I have several Flat File destinations and I need to change the output column order in each. I've opened...

This email has been sent to {user_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.
Feel free to forward this to any colleagues that you think might be interested.
If you have received this email from a colleague, you can register to receive it here.
This transmission is ©2017 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
Contact: webmaster@sqlservercentral.com