Skip to content

Tag: T-SQL Tuesday

Using a Numbers Table in SQL Server to insert test data (T-SQL Tuesday #65)

T-SQL Tuesday

T-SQL Tuesday #65 is hosted by Mike Donnelly (@SQLMD). There is no specific topic to write about this month, Mike simply wants us to learn something new and then write a blog post to teach it to others. I want to share something that I only recently learned, something I wish I had known about years ago, something that became part of my toolbox as soon as I discovered it: the Numbers Table. It is so simple and solves so many problems that everyone should know about it :)

A Numbers Table (perhaps most known as a Tally Table, sometimes called an Auxiliary Table of Numbers and even referred to as the Swiss Army Knife of SQL Server) is a one-column helper table that contains the numbers 1, 2, 3, 4, 5 and so on all the way up to the-highest-number-you-could-possibly-need.

It can be used to replace slower loops and row-by-row operations with faster set-based operations, generate dates, split strings, find gaps in data sets, expand data sets, insert test data and probably hundreds of other things. There are so many great and detailed articles already published about this topic, so I will stick to the T-SQL Tuesday topic of “Teach Something New” and share the two most recent things I learned: different ways to create a numbers table, and different ways to quickly insert test data by using a numbers table.

Continue reading →

#SQLFamily – Pay It Forward (T-SQL Tuesday #57)

T-SQL TuesdayT-SQL Tuesday #57 is hosted by Jeffrey Verheul (@DevJef) and the topic is #SQLFamily. This is a topic close to my heart and even while writing this I’m all excited to read other stories. I can go on for ages about #SQLFamily, but I’ve decided to focus on one thing: paying it forward.

One year ago I had never heard about #SQLFamily and I didn’t even know the SQL community existed. I knew people wrote blogs and forum posts, I knew some taught classes and others published books, but I was your average employee: I did my job, learned what I had to learn to do my job well, and searched online to find solutions and better ways to do things.

Then I went to PASS Summit 2013 and the experience turned my life upside-down.

What happened? People welcomed me with open arms. They invited me to join them at #SQLKaraoke, introduced me to their friends, told me stories about SQLSaturdays and taught me about the community. They didn’t tell me about #SQLFamily, they were #SQLFamily. Even before I went back home to Norway I decided that I would do whatever I could to bring the SQL community to Norway.

This is an excerpt from the blog post I wrote after PASS Summit 2013: “I hope to attend and volunteer at a SQLSaturday, maybe even help organize one in Oslo. I hope to share my new knowledge with my co-workers and help improve our solutions at work. I hope to learn even more and get to know my new connections better. Maybe I’ll even make my own presentation and be a first-time speaker some day!”

In the ten months since I wrote that, I’ve become a board member of SQL Server User Group Norway, I’ve volunteered at SQLSaturday Copenhagen, I’ve done a SQLHangout video, I’m organizing the first SQLSaturday in Norway, and for the first time I’ll speak in another country at SQLSaturday Portugal. I’ve met so many wonderful people and I’m looking forward to getting to know even more. It’s hard to believe it all started when #SQLFamily members spent a couple of minutes saying “hi” to me. So little, yet so much! The last ten months have been a whirlwind, and I’ve enjoyed every single moment of it.

I’m so thankful for everything I’ve experienced this year. Paying it forward and helping my local community has given me something meaningful to do every day, and because I have so many amazing memories I’m now even more determined to keep paying it forward, and to give back. I’ve experienced first-hand how something someone might not even think of, like a friendly smile and a “join us”, can mean to someone else.

If I can pay it forward to just one first-timer at PASS Summit 2014, to welcome someone to the #SQLFamily… it will be worth the whole trip.

Pay it forward. You can change someone’s life :)