SQL Server - Extracting All The Words From a String In An SQL Query

Extracting All The Words From a String In A SQL Server Database Query

It is easy enough to extract the first word from a string in a database query, but what if you need to separate all words in a given string into a list of separate words?

This is a job for Common Table Expressions (CTEs) as they enable us to repeatedly read a single record while changing it each time.

Here is a SQL Server example which takes a string variable and spearates it into inidividual words. We use a combination of CHARINDEX, LEFT and RIGHT functions to achieve it.

SQL Server - Why is this query so slow?

How many times have you asked yourself that question?

If you work with SQL Server based applications then probably quite a few!

No matter what the application you are working with (CRM, Sales Order Processing, Financial Accounting, Contact Management, Booking System (to name but a few!)) there is a database behind it. Most common applications will store their data in either a Microsoft SQL Server Database or an Oracle Database (of course there are other relational database platforms out there).

SQL Server 2016 - R Service

One More Language to Learn!

So, we have had SQL, TSQL, MDX, DMX, DAX to keep us busy in the SQL Server world for years now so I guess it was about time another language came along to join them!

SQL Server 2016 enters the world of Big Data with its PolyBase and R Services.

 

The SQL Server R Service

The R Service enables integration of R scripts into TSQl scripts. 

SQL Server - SQL CROSS APPLY Statement

Using CROSS APPLY In SQL SELECT Statements

In this article I  take you through the following:

  • CROSS APPLY
  • OUTER APPLY
  • CROSS APPLY with User Defined Table Valued Functions

When Should We Use The CROSS APPLY Statement

The CROSS APPLY statement behaves in a similar fashion to a correlated subquery, but allows us to use ORDER BY statements within the subquery. This is very useful where we wish to extract the top record from a sub query to use in an outer sub query.

MDX - Counting Members at a Hierarchy Level

Counting Members in an MDX Query

MDX is a challenging query language. It is completely different to the SQL query language despite having a SELECT statement!

MDX queries are all about hierarchies, measures and members and when it comes to carrying out tasks that are simple in SQL it may not be so simple in MDX.

Most of the time when we work with MDX queries we are interested in bringing out aggregate values that are stored in our cube, but occasionally we may want to derive values from the stored cube data.

Pages