Categories
SQL Server

Partition Switching in SQL Server

Continuing with our recent theme of partitioning I wanted to make sure that we looked at one of my personal favourite features – Partition Switching. Partition Switching is the ability to switch an entire partition of data from one table to another almost instantly. Where it gets interesting is that this is the same operation […]

Categories
SQL Server

Managing Table Partitions (Part 2)

Last time out, following up to our posts looking at an introduction to partitioning and how to implement it we started to look at how to manage partitions. In this post we’ll continue that theme by looking at how we’d go about removing (or merging) partitions as well as covering some general considerations when we’re performing operations on partitions and […]

Categories
SQL Server

Managing Table Partitions (Part 1)

Last time out we tried our hand at implementing partitioning on a table with some data inside it. We looked at creating the partition function, followed by the partition scheme, and then applied that to our table and looked at the results. Following up on that I now wanted to look at how we can manage […]

Categories
SQL Server

Implementing Table Partitioning

A little while back we looked at an introduction to table partitioning where we covered the concepts involved in the partitioning. This time out we’ll look at how to implement those concepts to create a partitioned table. As we’re going through the motions for this let’s start off by creating a table and fill it with some […]

Categories
T-SQL Tuesday

T-SQL Tuesday #156 – Production Code

This month’s invitation from Tom Zika asks us to consider production code and consider what quality makes the code ‘production grade’. It’s interesting to think about all of the areas we may want to consider before putting some code into production – has it been reviewed, has it gone through sufficient testing, does it perform well […]

Categories
SQL Server

Challenges with Changing Object Schema

A few weeks back we looked at altering an object inside our database and changing the schema in which it resides. Whilst the ALTER SCHEMA … TRANSFER statement itself is straightforward, there are some gotchas you might find as a result of the change which I thought it was worth covering. To set up for what we’re going […]

Categories
SQL Server

Comparing Views and Synonyms in SQL Server

Last time out we looked at referencing tables across databases. While we of course have the option of using three-part naming to address the table, we also considered views and synonyms as two alternative options. Both of these can be used to achieve similar results. There are elements which they have in common and others which […]

Categories
SQL Server

Referencing Cross-Database Objects

In SQL Server we’ll typically end up using environments containing multiple databases which happen to have data which relate to each other. Due to this there will be times when we’ll need to reference objects in another database when writing a query. What options do we have for doing this? Here we’ll look at three […]

Categories
T-SQL Tuesday

T-SQL Tuesday #155 – The Dynamic Code Invitation

This months’ invitation from Steve Jones asks us to write about producing SQL dynamically in some form or another. We can create and execute SQL dynamically within our procedures but what about dynamically creating it from other sources before passing it into SQL Server? The quick I have to admit that Steve’s mention of using Excel […]

Categories
SQL

Changing Object Schema in SQL Server

We’ve previously looked at the basics of using schemas in SQL Server where we created a schema and used objects inside of it. If you’re not dealing with new objects though and wanted to move something into or out of a schema how to we go about that? Not by renaming it For renaming most objects within […]