Editorials

Editorials

A Little ROW_NUMBER Magic

I really like the ROW_NUMBER() function in SQL Server as a means of getting the first or last instance of a record for each specific group within record set containing more than one group. Ok, let me break that down a little bit. It’s pretty easy to get the last record of the line items for a single purchase order. […]

Editorials

The Power of Coalesce

Cascading Style Sheets (CSS) are an HTML technique for formatting the display of html documents in a standard fashion. They are called Cascading because there is a hierarchy to how the styles are defined and implemented. Styles implemented in the HTML document itself override other styles. The concept I want to communicate here is that the same HTML tag may […]

Editorials

Concurrent Queries – Going to MARS

Multiple Active Result Sets (MARS) were introduced with SQL Server 2005. When you connect to an SQL Server database you are able to request and receive a TDS (Tabular Data Stream) from the database. Using MARS you are able to receive more than one TDS stream concurrently over the same connection. MARS controls the routing of each stream to the […]

Editorials

Where Should We Handle Null Values?

Where do you deal with null? The reality is that if you work with a relational database, you will most likely have to address the value, or non-value, of null. Some believe you should do everything you can to remove null from a database. For example, if an individual is working in the USA they must report their income to […]

Editorials

DataTable Extension To Resolce Column Ordinal Positions By Name

Today I am expanding on the demonstration of Extension methods from yesterday, with the goal to increase performance of processing data from a DataTable while maintaining flexibility. Yesterday we created new methods to read columns from a DataTableReader, and handle the value if it was null by providing a default value. This modification simplified code readability and provided less opportunity […]

Editorials

DataTableReader Extension Methods

Today I would like to demonstrate something you can do with the DataTableReader to make it easier and more efficient to use. The first thing I want to demonstrate is the creation of an Extension Method that allows you to emulate the SQL ISNULL function. The SQL ISNULL function tests a value for null, and if it is null, returns […]

Editorials

Multiple Results From Queries

When using ADO.Net it is possible to have a query return more than one result set, translated into an DataSet , or by returning more than one DataTable sequentialy. If you use a DataSet to get each of the individual query results you can simply use the [DataSetInstance].Tables collection to interact with the results of each query. If you prefer, […]

Editorials

What’s a Cartesian Product?

One of my favorite interview questions is to as the candidate, “what is a Cartesian Join?” Sometimes the candidate won’t know what a Cartesian is, but they are familiar with the SQL Server syntax of a Cross Join. The answer is that a Cartesian join returns all the records in one table joined to all the records in a second […]

Editorials

An Easier Way to Learn CQRS

I have written a number of times about the CQRS pattern for communication of data in computer applications. CQRS stands for Command Query Response Segregation. This pattern is based on the theory that a system usually has higher read activity than create/update/delete activity. The create/update/delete activity is considered a command. The read activity is considered a response. So, the pattern […]