In my last post, we worked out how to change the data type of a field if it already existed and was found to need changing. This time, I want to add a fresh, new column to an existing table. In SQL Server, I would be doing something like the following. ALTER TABLE dbo.TestTable ADD…… Continue reading Getting New and Old Columns to a Table
Category: SQLBasics
Odd things found when working with data
Sometimes, you’ll find all sorts of craziness when you’re working with data. Especially if you don’t expect there to be any craziness. Let me show you what I mean by a story of what I had happen just this week. In mapping some data from one database to another, I was asked to do the…… Continue reading Odd things found when working with data
Common Table Expressions Can Be A Good Thing
Most of our coding these days has Common Table Expressions, also known as CTEs. If not, you’re either working on an older version of SQL Server or you haven’t been introduced to this piece of goodness. CTEs can make reading SQL queries a lot easier if the logic is convoluted. For example, let’s use the…… Continue reading Common Table Expressions Can Be A Good Thing
That’s Just NOT Right
Today, I want to talk about the keyword NOT in SQL Server. It can be your friend or your worst enemy depending upon how you use it. Let’s delve into some examples of what I’m talking about and how it’s easy for people to mess it up. Let’s say we have a table named DataTable.…… Continue reading That’s Just NOT Right
Scrutinizing the Data in All of our tables
Today, I was working with SQL Server to get row counts from several tables so I thought I’d be smart and work with some functions in SQL Server to make it smarter / easier. Now, if I am truly only getting “straight” row counts from these tables, I would be able to create a query…… Continue reading Scrutinizing the Data in All of our tables
Walking Through Advent of Code Day 9 Part 2
Welcome back after a long, much-needed break! Hopefully, you’ve had time to reenergize and are now ready to start 2024 with a bang! Thankfully, the elves were semi-nice to us for part 2 and only slightly changed their requests and wanted us to find the first number in the solution instead of the last. If…… Continue reading Walking Through Advent of Code Day 9 Part 2
Walking Through Advent of Code Day 9
And so day 9 begins. Today, our elves are working hard on having us come up with the next number in a sequence. Thankfully, they do give us a few good examples to walk through on how they would like us to do it. And with that, it’s off to the races! As always, we…… Continue reading Walking Through Advent of Code Day 9
Walking Through Advent of Code Day 8 Part 2
With Day 8 part 1 being all about traversing tables, I’m sure our little friends the elves will find a new way to make this harder for us. First, we find out that we’re now starting with multiple positions – anything that ends with an A – and finishing anywhere that ends in a Z.…… Continue reading Walking Through Advent of Code Day 8 Part 2
Walking Through Advent Of Code Day 8
Day 8 is gonna be fun-filled and exciting I can tell it from here! To make life a little simpler for all of us, I used a variable that I just pasted my instructions into. In my case, I called it @FollowThis allowing it to be up to 300 characters in length. Hopefully, no one’s…… Continue reading Walking Through Advent Of Code Day 8
Walking Through Advent of Code Day 7 Part 2
So, we got tired of playing Camel Cards and decided to throw some Jokers into the mix. This time, our wonderful friends the elves have decided that they don’t like Jacks but they do like Jokers. So, there are a few changes to our code that will need to be made: with cte as (…… Continue reading Walking Through Advent of Code Day 7 Part 2