Click here to monitor SSC

Author Profile

Robert Sheldon

After being dropped 35 feet from a helicopter and spending the next year recovering, Robert Sheldon left the Colorado Rockies and emergency rescue work to pursue safer and less painful interests—thus his entry into the world of technology. He is now a technical consultant and the author of numerous books, articles, and training material related to Microsoft Windows, various relational database management systems, and business intelligence design and implementation. He has also written news stories, feature articles, restaurant reviews, legal summaries, and the novel 'Dancing the River Lightly'. You can find more information at http://www.rhsheldon.com.

14 SQL Server Indexing Questions You Were Too Shy To Ask

One of the first things one needs to understand well about SQL Server is indexes, but somehow many of the basic questions don't often get asked or answered much on forums. Rob Sheldon answers some of these shy-making questions about SQL Server Indexes and indexing: the ones we somehow feel silly asking in public, and think twice about doing so. Read more...

Seven SQL Server Under-Used Utilities

There are more than ten useful command-line applications that are either associated with, or are distributed with, SQL Server. Some, like BCP are used often, whereas others like LogDumper, almost never. However, they all have their uses and several become important as part of script-based automation of tasks. It is definitely worth knowing what is lurking in your tools\binn directory. Read more...

The SQL Server Sqlio Utility

If, before deployment, you need to push the limits of your disk subsystem in order to determine whether the hardware’s I/O capacity meets the needs of a database application, if you need performance baselines, or if you want to identify any performance-related issues, then why not use the sqlio utility? Read more...

The SQL Server Sqliosim Utility

The sqliosim utility is provided with SQL Server to test the I/O stability and 'correctness' of a server. It doesn't measure performance but simulates the read, write, checkpoint, backup, sort, and read-ahead activities of a typical SQL Server instance under load. It is generally used before installing SQL Server in order to ensure that new hardware can handle your expected loads. Bob Sheldon explains. Read more...

SQL Server tablediff utility

Rob Sheldon continues on his quest to explain all those command-line tools such as SQLCMD, Logparser, SQLIO and tablediff that are part of SQL Server. TableDiff can be used for comparing tables, as when you run automated tests that check a result against a table of expected values. The best way to learn TableDiff is to see it in action and Rob talks you through several examples. Read more...

Microsoft's Log Parser Utility: Swell ETL

For loading text, CSV or XML files into SQL Server, the Log Parser utility, with its amazing SQL engine, is likely to be the obvious choice. Although initially developed purely for converting IIS logs, the Log Parser can turn its hand to a range of formats including even event logs or the Windows registry. Read more...

SQL Server SQLCMD Basics

Sqlcmd makes many SQL Server tasks, such as automating test runs and maintenance tasks, easier and quicker. The sqlcmd command-line utility is valuable to any database developer or DBA as the prime means of executing batches of SQL Statements to SQL servers, and saving results to file. Rob Sheldon gives you the basic facts about this great utility Read more...

DAX Statistical Functions

Following on from his first four articles on using Data Analysis Expressions (DAX) with tabular databases, Robert Sheldon dives into some of the DAX statistical functions available, demonstrating which are the most useful and examples of how they work. Read more...

Using DAX to create SSRS reports: The Basics

You can use DAX to create reports from a tabular database in SQL Server Reporting Services. To do so requires a few workarounds. Rob Sheldon describes a poorly-documented but important technique for Business Intelligence. Read more...

Columnstore Indexes in SQL Server 2012

The columnstore index in SQL Server 2012 stores columns instead of rows, and is designed to speed up analytical processing and data-warehouse queries. Whilst columnstore indexes certainly do that effectively, they are not a universal panacea since there are a number of limitations on them. When used appropriately, they can reduce disk I/O and use memory more efficiently. Read more...

Using Microsoft Excel to Retrieve SSAS Tabular Data

Although it is well-known how to create a tabular database in PowerPivot, it is less obvious that there are several useful options for retrieving SSAS tabular data into Excel. This provides an easy way of manipulating, visualizing and analyzing the data without needing to know the details of SSAS and the tabular model. Read more...

Using DAX to retrieve tabular data

Data Analysis Expressions (DAX), originally the formula language for PowerPivot workbooks, can also be used within the MDX query window of SSMS to directly access data from a tabular SSAS database, an in-memory database that uses the xVelocity analytics engine and compression. Robert Sheldon shows how easy it is to retrieve data from a tabular database. Read more...

Getting Started with the SSAS Tabular Model

SSAS Tabular models are in-memory databases that model data with relational constructs such as tables and relationships, in order to provide a rapid and powerful way of providing self-service BI to client applications such as Microsoft Excel and Microsoft Power View. You’ve deployed SSAS in tabular mode, and deployed Adventureworks into it. What next? Rob Sheldon explains all. Read more...

Getting Started Testing Databases with tSQLt

There are several frameworks for assisting with the testing of SQL Server databases, but tSQLt is popular because it is written in TSQL and is simple for a database developer to set up and use. It doesn't get in the way. Rob Sheldon shows you how to get started. Read more...

Business Intelligence and Microsoft

Microsoft have a lot to offer for anyone who is engaged in using Business Intelligence. The problem is in pulling together all the products in order to paint a picture of the entire landscape. Three book shed light on several different aspects, but there is plenty more to discover. Read more...

SQL Server 2012 Window Function Basics

For some time, Microsoft had a few window functions, but not the full set specified in the SQL 2003 standard. Now, in SQL Server 2012 we have the whole range, and extremely useful they are too. There's no longer an excuse to avoid them, particularly now you have Rob's gentle introduction. Read more...

Some Books on Programming SQL Server 2012

It is a measure of the range of facilities that are available to the database developer nowadays that three different books on the same general topic of TSQL programming  can actually complement each other. Read more...

Getting Started with Extended Events in SQL Server 2012

Extended Events provide a way of unintrusively monitoring what's going on in a SQL Server instance. Unlike SQL Server Profiler and SQL Trace, it has little performance impact. Now, in SQL Server 2012 SSMS, it is relatively easy to use, as Robert Sheldon shows. Read more...

Handling Errors in SQL Server 2012

The error handling of SQL Server has always been somewhat mysterious. Now at last, the THROW statement has been included in SQL Server 2012 that, combined with the TRY ... CATCH block, makes error handling far easier. Robert Sheldon explains all. Read more...

Report Builder 3.0: Adding Matrices to Your Reports

It is easy to create a basic matrix in Report Builder. However, it takes some practice in order to format and display the matrix exactly how you want it. There are a large number of options available to enhance the matrix and Robert provides enough information to get you the point where you can experiment easily. Read more...

Book Review: Pro SQL Server 2012 Relational Database Design and Implementation

A book on Relational Database Design and Implementation is always welcome, especially when written by one of Simple-Talk's most popular authors, Louis Davidson. Bob Sheldon casts the critical eye on the book and smiles upon what he sees. Read more...

Report Building 3.0: Adding Maps to Your Reports

With Report Builder and SSMS, there isn't much you can't do in the way of the common reports and visualisations. One of the more interesting visualisations uses maps, and that, combined with layers, makes for an impressive way of representing data. Read more...

Book Review: Microsoft SQL Server 2012 Bible

A broad topic requires a thick book. the Microsoft SQL Server 2012 Bible is the work of several authors and comes to 59 chapters, yet it has all been edited into a single work that provides most of what you need to know about SQL Server outside your own specialization. Read more...

Report Builder 3.0: Adding Charts to Your Report

Charts are one of the commonest ways of visualizing reports from data. Report Builder provides a way of generating charts and reports that will be intuitive to anyone who has done the same in Excel. Robert provides a simple explanation of how to get the best from charts using Report Builder. Read more...

Report Builder 3.0: Formatting the Elements in your Report

There is a lot that can be done to make basic tabular reports more readable, using Microsoft's free Report Builder. Rob Sheldon continues his exploration of the power of this tool by showing how to format various elements within reports. Read more...

Report Builder 3.0: Creating a Basic Report

Report Builder is underrated as a BI and report-authoring tool. It is a free stand-alone application from Microsoft that provides an intuitive way for anybody to create reports from data. It uses an interface that is similar to Microsoft Office, and supports the full capabilities of SQL Server 2012 Reporting Services. Rob Sheldon starts a short course in how to use it. Read more...

Working with SSIS Data Types

In order to be able to take data from a variety of sources, manipulate it, and then export it to one of several destinations, SSIS has to use its own data types. Generally, the conversions of data types is handled implicitly, but if you hit problems, then you may need to intervene in one of several ways to ensure an appropriate conversion. Read more...

Implementing Lookup Logic in SQL Server Integration Services

With SSIS, you can perform a lookup on data in the course of a task, using referenced data from any OLE DB source. It is a useful feature that enables you to check on the validity of data, or interpret it before proceeding. Robert Sheldon explains. Read more...

Implementing Foreach Looping Logic in SSIS

With SSIS, it is possible to implement looping logic into SSIS's control flow in order to define a repeating workflow in a package for each member of a collection of objects. Rob Sheldon explains how to use this valuable feature of SSIS Read more...

Working with Variables in SQL Server Integration Services

There are a number of ways that you can incorporated variables into your SSIS Scripts. Robert Sheldon demonstrates how. Read more...

Converting String Data to XML and XML to String Data

We all appreciate that, in general, XML documents or fragments are held in strings as text markup. In SQL Server, XML variables and columns are instead tokenised to allow rapid access to the data within. This is fine, but can cause some odd problems, auch as 'entitization'. What, also, do you do if you need to preserve the formatting? As usual Rob Sheldon comes to our aid. Read more...

Incorporating XML into your Database Objects

XML data can become a full participant in a SQL Server Database, and can be used in views, functions, check constraints, computed columns and defaults. Views and table-valued functions can be used to provide a tabular view of XML data that can be used in SQL Expressions. Robert Sheldon explains how. Read more...

The XML Methods in SQL Server

The XML Data type has definite uses, but the way of interrogating, retrieving, and manipulating the values of properties and attributes within XML have been so foreign to the SQL language as to be somewhat of a barrier to their use. Fortunately, Robert Sheldon has once more managed to make the subject accessible to those of us who just need to get the job done. Read more...

Working with the XML Data Type in SQL Server

The XML data type, introduced in SQL Server 2005, is a powerful construct. When used wisely, it can provide useful extensions to SQL Server. Robert Sheldon, in the first part of a series, describes how create and index a typed XML column in a table, and discusses when you should consider using an XML Datatype. Read more...

Implementing Checkpoints in an SSIS Package

Like any other application, an SSIS package can fail. Once the problem has been resolved, you'll usually restart the package, but if you implement SSIS checkpoints, then you have another option: you can restart from the point of failure. Read more...

Debugging Data Flow in SQL Server Integration Services

You can save a lot of time by using the SSIS Troubleshooting tools. These enable you to work with reduced data samples, monitor row counts, use data viewers, configure error-handling and monitoring package execution. Although you can develop SSIS packages without them, it is so much easier once you're familiar with these tools. Read more...

XML Configuration files in SQL Server Integration Services

Package configuration files are a great way of providing the values of SSIS package properties so that packages can be used in a far more versatile way. They make the deployment of SSIS packages easier and can provide parameters that are based on the server configuration, or which change for each runtime. They're easy to understand, especially when explained by Rob Sheldon. Read more...

Adding the Script Task to Your SSIS Packages

Script tasks are a great way of extending SSIS functionality, when the buit-in functionality isn't quite Script tasks are a great way of extending SSIS functionality, when none of the buit-in components are quite right for the task you need to perform. But how to go about creating a script task? No worries, once again Robert Sheldon is on hand to provide easy instructions on how to do it. Read more...

Table Value Constructors in SQL Server 2008

Table Value Constructors (TVCs) are a useful feature of 2008, allowing you to specify tables of values and expressions. This has all sorts of uses. Users who are stuck with previous versions of SQL Server can play along, since Rob demonstrates that there have, for a long time, been ways of doing this in SQL Server, though less elegantly. Read more...

Subqueries in SQL Server

Subqueries and derived tables can add great versatility to SQL statements, cut down complexity, but can occasionally be a curse when their effect on performance is poorly understood. Surely everyone understands the various types of subqueries and how they are used? If you felt a twinge of doubt, here is Rob Sheldon's easy guide to the subject. Read more...

SSIS Event Handlers Basics

SSIS event handlers are the simplest means of turning an SSIS script into a reliable system that is auditable, reacts appropriately to error conditions, reports progress and allows instrumentation and monitoring your SSIS packages. They are easy to implement, and provide a great deal of flexibility. Rob Sheldon once again provides the easy, clear introduction. Read more...

Using SQL Server Integration Services to Bulk Load Data

The most flexible way to bulk-load data into SQL Server is to use SSIS. It can also be the fastest, and scaleable way of doing so. There are three different components that can be used to do this, using SSIS, so which do you choose? As always, Rob Sheldon is here to explain the basics. Read more...

The EXCEPT and INTERSECT Operators in SQL Server

The UNION, EXCEPT and INTERSECT operators of SQL enable you to combine more than one SELECT statement to form a single result set. The UNION operator returns all rows. The INTERSECT operator returns all rows that are in both result sets. The EXCEPT operator returns the rows that are only in the first result set but not in the second. Simple? Rob Sheldon explains all, with plenty of examples Read more...

Bulk Inserts via TSQL in SQL Server

The trouble with using BCP for reading data into SQL Server is that BCP is a command-line program. Fortunately, the same input functionality is available from TSQL within SQL Server. In fact there are two ways, and it is not always obvious which to use. Read more...

Data Conversion in SQL Server

Most of the time, you do not have to worry about implicit conversion in SQL expressions, or when assigning a value to a column. Just occasionally, though, you'll find that data gets truncated, queries run slowly, or comparisons just seem plain wrong. Robert explains why you sometimes need to be very careful if you mix data types when manipulating values. Read more...

The DELETE statement in SQL Server

Of the big four DML statements in SQL Server, the DELETE is the one least written about. This is odd considering the extra power conferred on the statement by the addition of the WITH common_table_expression; and the OUTPUT clause that essentially allows you to move data from one table to another in one statement. Read more...

Working with Window Functions in SQL Server

With SQL Server 2005, SQL Server introduced some of SQL's window functions, that apply, not to the full set, but a partitioned 'window'. Although the ROW_NUMBER, RANK, NTILE and DENSE_RANK bring great power to TSQL, the full versatility will not be available until SQL Server delivers the full implementation. As usual, Robert Sheldon explains all. Read more...

Working with the INSERT statement in SQL Server

The INSERT statement in SQL Server is versatile. It now allows the insertion of multiple rows of literal values. It also provides the output clause that solves a number of common problems such as ascertaining the value of identity fields, and other calculated fields in tables, or for auditing the rows that are added to tables. Robert, once again, gives a clear introduction. Read more...

The MERGE Statement in SQL Server 2008

When the SQL MERGE statement was introduced in SQL Server 2008, it allowed database programmers to replace reams of messy code with something quick, simple and maintainable. The MERGE syntax just takes a bit of explaining, and Rob Sheldon is, as always, on hand to explain with plenty of examples. Read more...

Implementing the OUTPUT Clause in SQL Server 2008

In retrospect, it was probably the inclusion of the OUTPUT clause in the MERGE statement that gave SQL Server 2008 its most powerful SQL enhancement.. It isn't the easiest of features to explain, but Bob does it in his usual clear and careful way. Read more...

UPDATE Basics in SQL Server

SQL Server's UPDATE statement is apparently simple, but complications such as the FROM clause can cause puzzlement. Bob Sheldon starts simply, and introduces the more complex forms painlessly. Read more...

SQL Server APPLY Basics

One of the most interesting additions to SQL Server syntax in SQL Server 2005 was the APPLY operator. It allows several queries that were previously impossible. It is surprisingly difficult to find a simple explanation of what APPLY actually does. Rob Sheldon is the specialist in simple explanations, so we asked him. Read more...

SQL Server CTE Basics

The CTE was introduced into standard SQL in order to simplify various classes of SQL Queries for which a derived table just wasn't suitable. For some reason, it can be difficult to grasp the techniques of using it. Well, that's before Rob Sheldon explained it all so clearly for us. Read more...

Adding Actions to a Cube in SQL Server Analysis Services 2008

Actions are powerful way of extending the value of SSAS cubes for the end user. They can click on a cube or portion of a cube to start an application with the selected item as a parameter, or to retrieve information about the selected item. Actions haven't been well-documented until now; Robert Sheldon once more makes everything clear. Read more...

Adding a KPI to an SQL Server Analysis Services Cube

Key Performance Indicators, which vary according to the application, are widely used as a measure of the performance of parts of an organisation. Analysis Services makes this KPI data easily available to your cube. All you have to do is to follow Rob Sheldon's simple instructions. Read more...

Implementing User-Defined Hierarchies in SQL Server Analysis Services

To be able to drill into multidimensional cube data at several levels, you must implement all of the hierarchies on the database dimensions. Then you'll create the attribute relationships necessary to optimize performance. Analysis Services hierarchies offer plenty of possibilities for displaying the data that your business requires. Rob Sheldon continues his series on SQL Server Analysis Services 2008. Read more...

Five Basic Steps for Implementing an Analysis Services Database

To learn an application, nothing beats getting it up and running. Getting started with Analysis Services can be frustrating unless you have a clear and simple guide that gets you started quickly. In this article, the first in a quick-start series on SSAS, BI and Data Warehousing, Rob Sheldon gets you off the runway, and flying. Read more...

Working with the bcp Command-line Utility

Even though there are many other ways to get data into a database, nothing works quite as fast as BCP, once it is set up with the right parameters and format file. Despite its usefulness, the art of using the command-line utility has always seemed more magic than method; but now along comes Robert Sheldon to shed light on the murky details. Read more...

Managing Transaction Logs in SQL Server

The Transaction Log provides the means by which either the complete set of tasks of a database transaction are performed or none of them are. It ensures that , via rollback, only valid data is written out to the database, and it allows transactions to be played back to recreate the system state right before a failure. Robert Sheldon explains the various basic tasks involved in managing the transaction log. Read more...

Using Information Schema Views

Many seasoned database developers tuck away all the commonly-used INFORMATION_SCHEMA queries as templates. They're an indispensable supplement to sp_help and sp_helpText to get handy information about your database objects, and, even if you use SQL Prompt, they're usually the best standard way to access such information programmatically within a routine. They are ISO standard SQL and are here to stay. Rob Sheldon goes through the basics in a timely refresher course. Read more...

Transact-SQL Formatting Standards (Coding Styles)

How should SQL code be formatted? What sort of indentation should you use? Should keywords be in upper case? How should lists be lined up? SQL is one of those languages that will execute anyway however you treat whitespace and capitalization. However, the way SQL is laid out will effect its readability and the time taken to review and understand it. Standardisation of code layout is an important issue, but what standard should you adopt? Rob avoids a direct answer, but tells you the sort of answers you'll need to decide upon when creating a strategy for formatting SQL code. Read more...

Defragmenting Indexes in SQL Server 2005 and 2008

Rob Sheldon tackles the subject of Index Defragmentation in SQL Server 2005 and 2008, using the sys.dm_db_index_physical_stats system function. He shows how to analyze indexes and, if necessary, how to go about  reorganizing or rebuilding indexes. He makes the point that, by analyzing indexes effectively, you can save a lot of unnecessary  rebuilding of indexes. Read more...

Working with Precedence Constraints in SQL Server Integration Services

In SSIS, tasks are linked by precedence constraints. A task will only execute if the condition that is set by the precedence constraint preceding the task is met. By using these constraints, it is possible to ensure different execution paths depending on the success or failure of other tasks. This means that you can use tasks with precedence constraints to determine the workflow of an SSIS package. We challenged Rob Sheldon to provide a straightforward practical example of how to do it. Read more...

Using the FOR XML Clause to Return Query Results as XML

The FOR XML clause in SQL Server causes a lot of difficulty, mainly because it is rather poorly explained in Books-on-Line. We challenged Bob Sheldon to make it seem simple. Here is his sublime response. Read more...

XML Data Modification Language Workbench

XML Data Modification Language (XML DML) allows you to modify and update XML data. When working with SQL Server Databases, this is the most efficient way to modify elements in an XML column, yet the techniques of using XML-DML have not been well, and simply, described - up until now. Robert Sheldon presents a practical workbench to show the various modify methods Read more...

Working with Property Expressions in SQL Server Integration Services

Property Expressions in SSIS packages are assigned to a property at run time. This allows parameters to be passed to a package every time they are run, making them far more versatile. Despite their obvious usefulness, they are not well known. Hopefully, Bob's article puts things right. Read more...

Full-Text Indexing Workbench

Robert Sheldon continues his guide to Full-Text Indexing, by putting down his pen and reaching for SSMS for a practical workbench on Full-Text indexing. There is nothing like trying things out to make ideas click. Read more...

Understanding Full-Text Indexing in SQL Server

Microsoft has quietly been improving full-text indexing in SQL Server. It is time to take a good look at what it offers. Who better to give us that look than Robert Sheldon, in the first of a series. Read more...

SQL Server Index Basics

Given the fundamental importance of indexes in databases, it always comes as a surprise how often the proper design of indexes is neglected. It often turns out that the programmer understands detail, but not the broad picture of what indexes do. Bob Sheldon comes to the rescue with a simple guide that serves either to remind or educate us all! Read more...

SQL Server Data Warehouse Cribsheet

It is time to shed light on Data Warehousing and to explain how SSAS, SSRS and Business Intelligence fit into the puzzle. Who better to explain it all then Robert Sheldon. Read more...

Using Powershell to Generate Table-Creation Scripts

For all of us who learn best by trying out examples, Bob Sheldon produces a PowerShell script file for SQL Server that can be used in either SQL Server 2005 or 2008, has error handling and prompts for user-input, is easily extended and, does something useful. He then explains how to run it and what each line does. Magic Read more...

SQL Server 2008- SSIS Data Profiling task

By using SQL Server 2008’s new Data Profiling task, you can do a lot to ensure that data being imported via SSIS is valid, and you can develop a system that can take the necessary steps to correct the commonest problems. Bob Sheldon shows you how to get started with it Read more...

SQL Server 2008 SSIS Cribsheet

SSIS has achieved several new and interesting features in SQL Server 2008. And who better to guide you through them and explain them but Robert Sheldon. Read more...

Why Join

Over 400,000 Microsoft professionals subscribe to the Simple-Talk technical journal. Join today, it's fast, simple, free and secure.