SQL Server : Extract Text Using LEFT and RIGHT function with CHARINDEX

preview_player
Показать описание
In Sql server , How to extract local part and domain part from email column?

In SQL Server, LEFT and RIGHT are string functions used to extract a specific number of characters from a string:

LEFT Function Purpose: Returns the left part of a string with the specified number of characters.
Syntax : LEFT(string, number_of_characters)

RIGHT Function Purpose: Returns the right part of a string with the specified number of characters.
Syntax: RIGHT(string, number_of_characters)

CHARINDEX returns the starting position of a substring in a string. If the substring isn’t found, it returns 0.
Syntax : CHARINDEX(substring, string, [start_location(optional)])

Perfect for SQL beginners and data analysts who want to write smarter queries.

Have you used CHARINDEX before? Share how you’ve used it in your projects!

👇 Drop your questions and let’s solve them together.

👍 Like, 🔔 Subscribe, and 💬 comment with your SQL questions!
Рекомендации по теме
join shbcf.ru