In this post, we want to discuss a nice function to convert text to title case (Proper Case) in SQL Server. Before we get started, if you want to know about splitting with any delimited string, please go through the following article: Search string value in all columns of a table.

When reviewing that beyond the relational blog post we had an important comment about that blog. The comment was a question about How to search all columns with Multiple Words. For this problem let’s assume SQL Server 2008 and up, so we will be describing TVP (table-valued parameter) solution.

Let’s create a similar stored procedure that will work with the list of words to search in every character column in a table. First, we need to create a table type and then do the following modifications to the procedure:


Search All Columns with Multiple Words


Search All Columns in a Table for all Passed Words

To test this procedure you can pass string name to search, table schema, and table name like so:


Searching Specific Columns in all Tables of a Database

Finally, let’s consider the problem mentioned at the beginning of this article with the MSDN forum’s post reference which prompted this article. Let’s assume we know the column’s name but we don’t know the table’s name. The solution will be similar to what we have been using before:

The article was published on May 30, 2023 @ 9:43 PM

Leave a Comment