Tags » CHARINDEX

How to replace first occurrence of a word in a sentence in SQL Server

Have you ever thought of How REPLACE is working? It just replaces all the occurrences of a word in the sentence.

Lets look at an example. 250 more words

SQL Server

Extract string before a special character

Here is an easy way to get (extract) all of the characters before a special character in a string.  In our example we have a listing of email addresses and we want to get the name before the @domain. 241 more words

Hints And Tips

Using Charindex + Cross Apply to split delimiter-separated values (SQL Server)

Let’s suppose that we have some¬†delimiter-separated values, like this:

We want to separate the delimited values into five columns, like this:

We can solve this using the following code: 124 more words

SQL Server Transact-SQL