Tsql-Programming

Category: tsql-programming

TSQL Tuesday #93: Interviewing Patterns & Anti-Patterns

TSQL Tuesday #93: Interviewing Patterns & Anti-Patterns

on August 1, 2017

Welcome to T-SQL Tuesday for August 2017!

T-SQL Tuesday is a chance for you to join in the SQL Server community and write a blog post on a suggested topic. You can use this as a way to start a new blog, dust off a blog you haven’t used in a while, or make it part of regular blogging: your choice!

I would love for you to participate. The whole SQL Server community would. Please, join us!

Continue reading

Checking for the Existence of Global Temp Table in TSQL

Checking for the Existence of Global Temp Table in TSQL

Every now and again, I need use a global temporary table for some testing or demo code.

Each time I do, I stumble a little bit when it comes to checking for the existence of the global temp table, in order to make my code re-runnable.

Continue reading

Time for an Interview: What accomplishment are YOU most proud of?

Time for an Interview: What accomplishment are YOU most proud of?

on March 20, 2017

Last week I answered a set of fun interview questions from Mohammad Darab. One question that he asked really jumped out at me:

What are you most proud of doing/accomplishing for the SQL Server community so far in your career?

Continue reading

Adding Partitions to the Lower End of a Left Based Partition Function

Adding Partitions to the Lower End of a Left Based Partition Function

I recently got a table partitioning question from a reader:

We now need to load some historical data into the table for 2013 so I want to alter the function and schema to add monthly partitions for this. But I can’t work out how to do this using SPLIT? Every example and tutorial I’ve looked at shows how to add new partitions onto the end of a range, not split one in the middle.

Continue reading

Understanding Left vs. Right Partition Functions (with Diagrams)

Understanding Left vs. Right Partition Functions (with Diagrams)

You’re designing table partitioning, or you want to make a change to an existing partition function. It’s critical to understand the difference between how “left” and “right” partition functions behave, but the documentation is a bitΒ confusing on this topic.

Continue reading

Which Filegroup is that Partition Using? How Many Rows Does It Have?

Which Filegroup is that Partition Using? How Many Rows Does It Have?

Table Partitioning in SQL Server has a bit of a learning curve. It’s tricky to just figure out how much data you have and where the data is stored.

Continue reading

SPLIT in a LEFT Partition Function: Where Does the Above-Boundary Data Go?

SPLIT in a LEFT Partition Function: Where Does the Above-Boundary Data Go?

Table partitioning seems simple, but there’s a lot of complexity in designing and managing it if you decide to use filegroups and splitting.

When you first implement partitioning in this scenario, you decide where you’re going to keep “out of bound” data when you create your partition scheme. Be careful when you make that decision, because it may not be easy to change later.

Continue reading