Cleaning Numeric Strings Before Conversion in SQL Server

Working with messy numeric data is one of those unavoidable realities in database development. Whether you’re importing data from CSV files, web APIs, or legacy systems, you’ll often encounter numeric values stored as strings with all sorts of unwanted characters mixed in. SQL Server’s conversion functions are pretty strict about what they’ll accept, so you need to clean up these strings before attempting any conversions.

Read more

How to Select a Certain Number of Characters from the Left or Right of a String in SQL Server

If you ever find yourself wanting only the first part of a string, or the last part of it, this article might help.

This article is specific to SQL Server, but the functionality is pretty common across most/all database management systems, not to mention most programming languages.

When working with SQL Server, you can use theT-SQL LEFT() and RIGHT() functions to return any given number of characters from the left or right of a string.

Read more