Categories
SQL Server

Boolean Value Storage

Within SQL Server we can store Boolean data using the BIT data type. This value is a single bit which will store a True or False (or null) value. However if you dive a little deeper with the data type it’s actually a little less clear cut in terms of the storage needed for this data type. […]

Categories
SQL

Implementing Vertical Partitioning

We previously looked at an introduction to Vertical Partitioning where we covered what it is and the potential benefits and drawbacks of using it. Here I wanted to build up some data and show how we may vertically partition it to help make it more manageable for us. So that we’ve got some relevant data to use […]

Categories
SQL

Checking Data Types for Stored Procedure Results

When executing stored procedures it may appear simple enough to infer the data types which are being returned. However if those data types aren’t what you’d expect this could have downstream implications for the apps which are consuming the data. If we want to look at data in a table or view we can use […]

Categories
SQL

Introduction to Vertical Partitioning

When dealing with large volumes of data in SQL Server we may need to look for strategies to make querying and managing the data easier to handle. A few months back we looked at an approach where we partitioned our data into multiple segments by applying partition functions and schemes to our tables. This helps […]

Categories
SQL

Changing Identity from INT to BIGINT

When creating tables we may choose to use an INT column with an IDENTITY set as a unique clustering value. On occasions we find out that being able to store 2,147,483,647 records just isn’t enough and we need to change this field to be a BIGINT to let us store… well, a lot more. Here I’ll outline one approach which could […]

Categories
SQL Server

Partition Elimination in SQL Server

Back in our introduction to partitioning I’d mentioned that using partitions can also bring us benefits in terms of performance. That performance comes in the way of partition elimination with our queries. Before we get started let’s set the stage with a sample table and one million records of data which we’ve used before: What is partition elimination Partition […]

Categories
SQL Server

SSMS Tip: Saving Schema Changes

When using SQL Server Management Studio (SSMS) you have the option of creating or maintaining tables via regular SQL DDL statements or you can use the built in Designer tool which provides a GUI interface covering a selection of the same functionality such as adding fields, changing data types, maintaining foreign keys etc. Sometimes the […]

Categories
SQL Server

SSMS Tip: Show Table Details

Sometimes when you’re querying a set of data for the first time it can be tricky to understand the results you see. What are the data types? How is the data keyed? Are there any constraints in place? Does the table have foreign keys relating to other tables? So you might then end up scanning […]

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 […]