Daily Coping 24 Sep 2020

I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here.

Today’s tip is to don’t compare how you feel inside to how others appear outside.

I used to compare myself to others early in my career. The jobs they held, their salary, the projects they’d built or managed. Really, anything that others had accomplished. I think that can be useful early in your career to give you things to strive to accomplish.

Where this falls down is when you overvalue more than a specific goal from someone. While I might have wanted to manage a team of DBAs, or build software that provide real time analytics, I shouldn’t think that someone else’s path is the one I want to walk.

This can be the same phenomenon on Instagram, Facebook, etc. where it appears others have amazing lives and you don’t. Others might be loving their experiences when you’re struggling with the world.

I post the fun things and interesting experiences, but I don’t talk too often about the struggles between these amazing moments.

You don’t see the tough times or thoughts.

At least not many. I do expose more than a few friends think I should, but overall I keep a lot private, between family and friends. I have down times, I have difficult times, I question what I’m doing, how and why, on a regular basis.

My internal world is different from my external world. I try hard to remember that when I see things from others that might make me jealous of them.

Posted in Blog | Tagged , , | Comments Off on Daily Coping 24 Sep 2020

The Habits of Better Teams

As a developer, I’ve often worked with a team of others, where we discussed the software we were building, what architectures and patterns to adopt, etc. While we all learned to work together, there were plenty of times that it felt as if we were working separately on code, but arguing often about how to make a decision about a technical approach or a priority.

As a DBA, I’ve often worked alone, though usually interfacing with different teams as needed. In these cases, I’ve often had to learn to make my own decisions and then justify those to others later. The few times I worked with a team of DBAs, it seemed as though this was still the model, independent work, though with everyone deferring to the senior DBA.

Building a team takes work, and it can be difficult to do so without the support of management. I’m always amazed at how many managers undermine the building of a high performing team, often in contrast to their words or the company’s statements. Many don’t even realize how poorly they promote teamwork, or how they actively prevent it.

Assuming you can get support, what do you want in your team? I saw a neat post on the habits of high performing teams. These are some of the things you want to install in all your members. I’ve rarely had high psychological safety, though I think we do now at Redgate. I especially like the idea of leveling experience points. I hadn’t thought about it in these terms, but that makes perfect sense to me.

That last section, where we assume our peers are competent and intelligent resonates with me. I haven’t always done this in the past, but I have tried hard later in my career to listen more, and to assume others are working with the best information they have. Perhaps that’s different than my information, so I should try to have a discussion, not a lecture or a dismissal of their effort.

That’s something I wish I would have learned a lot earlier in my career.

Steve Jones

Listen to the podcast at Libsyn, Stitcher or iTunes.

Posted in Editorial | Tagged , | 2 Comments

Daily Coping 23 Sep 2020

I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here.

Today’s tip is to notice what you are feeling today without judgement.

I write this ahead of time, so I’ll tell you about my day today. It’s mid morning. I have been awake for awhile, working along, handling a variety of communications with different groups and people. It’s a hectic am, and my body is sore. A lot of workouts and ranch chores lately, and I’m fatigued.

However, I’m actually doing well. I followed this advice without knowing it this morning. I woke up, knowing I was tired, but needing to get to work. I accepted the soreness and feelings, choosing to work with them.

A few naproxen, which is a rarity for me, but I do use them when I’m especially uncomfortable. I had some time, so I treated myself to a coffee run in town. Not very efficient or cost effective, but it sparked joy, so I did it.

Then I went to work, accepting and handling things as they arose, even with a number that I hadn’t planned on needing to complete today.

Go with the flow is something I do often, even when it’s stressful on busy days, with lots of things that interrupt other items I need to handle.

Posted in Blog | Tagged , , | Comments Off on Daily Coping 23 Sep 2020

Cleaning up bad dates–#SQLNewBlogger

Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

I got some data recently from an online service, MapMyRun.com, where I track my workout data. I’ve been doing this for years, but with some of the instability and security issues with services, I decided I need to periodically grab a copy of my data and load it.

This post describes an issue with cleaning up the date data.

When I tried the load from SSMS (Tasks->Load Flat File), I got errors if I attempted to insert into a date field. My goal is to use the pattern of loading to a staging table and then merging data into my main table, so I decided to just load into a staging table. When I did this, here is what I saw.

2020-08-27 12_30_53-~vs7264.sql - ARISTOTLE_SQL2017.way0utwest (ARISTOTLE_Steve (58))_ - Microsoft S

For a human, the dates make perfect sense. For a computer, however, translating this to a date via an implicit conversion doesn’t work well. No problem, I can fix this. I’ll replace the date:

SELECT top 10
CAST( REPLACE(swh.Date_Submitted, 'Aug.', 'Aug') AS DATE) AS SubmitDate
, *
FROM dbo.staging_workout_history AS swh

This works great.

2020-08-27 12_33_28-~vs7264.sql - ARISTOTLE_SQL2017.way0utwest (ARISTOTLE_Steve (58))_ - Microsoft S

However, if I scroll through the entire file, I find issues with other dates. Once I remote the top, I get this:

Msg 241, Level 16, State 1, Line 1
Conversion failed when converting date and/or time from character string.

Hmmm, there are other issues. I could remove my CAST and scroll through, but there’s an easier way. I’ll use TRY_CAST() instead. If I restructure my query, I can run it to completion.

2020-08-27 12_40_27-~vs7264.sql - ARISTOTLE_SQL2017.way0utwest (ARISTOTLE_Steve (58))_ - Microsoft S

Now I can scroll through. I could also add a test for getting NULL from TRY_CAST to find the problematic dates. Here’s where I see more problems.

2020-08-27 12_41_08-~vs7264.sql - ARISTOTLE_SQL2017.way0utwest (ARISTOTLE_Steve (58))_ - Microsoft S

It seems that whoever exported data, from whatever system, decided periods in months make sense. I can amend the REPLACE in this way, which should fix things.

SELECT
TRY_CAST( REPLACE(swh.Date_Submitted, '.', '') AS DATE) AS IsItADate
, *
FROM dbo.staging_workout_history AS swh
 

Now I see this seems to work

2020-08-27 12_46_22-~vs7264.sql - ARISTOTLE_SQL2017.way0utwest (ARISTOTLE_Steve (58))_ - Microsoft S

One More Problem

I’m glad I kept scrolling through a full year. That’s because I saw this:

2020-08-27 12_47_33-~vs7264.sql - ARISTOTLE_SQL2017.way0utwest (ARISTOTLE_Steve (58))_ - Microsoft S

Who thinks Sept is the abbreviation for September? Technically it is, and I see April, June, and July spelled out, so the inconsistency in this extract is bizarre to me. Perhaps there is a database that formats English month names like this and deals with conversions, but this seems like sloppy programming to include “April”, “Jan.”, and then “Sept.” in your data set.

In any case, I can add another REPLACE() to my code.

SELECT
TRY_CAST( REPLACE(
                   REPLACE(swh.Date_Submitted, '.', '')
                   , 'Sept', 'Sep') AS DATE) AS IsItADate
, *
FROM dbo.staging_workout_history AS swh
WHERE  TRY_CAST( REPLACE(
                   REPLACE(swh.Date_Submitted, '.', '')
                   , 'Sept', 'Sep') AS DATE)  IS null

This converts all the dates in my column to the expected value. Now I need to do the same thing for other date columns, change TRY_CAST() to CAST() and I can import data.

Posted in Blog | Tagged , , | Comments Off on Cleaning up bad dates–#SQLNewBlogger