Remove Numbers from Text SVF, Nested vs CTE

I need to remove numbers from a string while processing some data  as part of an ETL process in a data warehouse.  I have to do this for many columns and potentially many tables so I decided to put the logic into a Scalar-Valued Function (SVF), understanding there are performance detriments when using SVFs. Generally this will be used on relatively small data sets for cleaning “codes” that will be insert into a slowly changing dimension.  I was curious about how to do this.  My instinct was to do it using nested replace functions.  I did a quick google search to see what options the collective would recommend.  I came across a post on Stack Overflow that mentioned the nested replace functions, and then someone also mentioned using a recursive Common Table Expression (CTE), which I thought was a creative suggestion.

https://stackoverflow.com/questions/13240298/remove-numbers-from-string-sql-server/

I have a soft spot in my heart for recursive CTEs so I thought I’d try both options and see which solution performs better.  Let’s start with building the functions:

Now that we have some functions we need some test data so let’s create a simple table and populate it with simi-random data by leveraging the newid() function.

Continue reading Remove Numbers from Text SVF, Nested vs CTE

Two

I don’t sleep, but I suddenly wake
My head is a race track
Your toy car follows each age line in my face
I smile
New lines are formed

Today you are two

Height, weight, and age can be measured
You can not measure my patience
But you know how to test it
Bip the Clown is no mute
A handsome Blok nonetheless
You can not measure my happiness
But you know how to grant it

Preparing for work
Drab as a fool, aloof as a bard
I daydream we are an adagio pair
And you are Atlantis soaring
Toothpaste drips onto my shirt

Stomping
Here comes the son
Winked an eye as you pointed your finger…
“I pooped Dada!”

Soon there will be two

Continue reading Two

Simon Sinek: The Video That Will Change Your Life

My boss had our department watch this today to give us some perspective on personal and workplace relationships.  Specifically, to give us some perspective when trying to open the minds of our co-workers to business intelligence.  I tend to hate “motivational” or “self help” types of videos but this one has a science twist that really spoke to me.

About this presentation:
In this in-depth talk, ethnographer and leadership expert Simon Sinek reveals the hidden dynamics that inspire leadership and trust. In biological terms, leaders get the first pick of food and other spoils, but at a cost. When danger is present, the group expects the leader to mitigate all threats even at the expense of their personal well-being. Understanding this deep-seated expectation is the key difference between someone who is just an “authority” versus a true “leader.”