mssqldata validation

Validate Email Address in SQL Server with PATINDEX

Validate email format in SQL Server using PATINDEX or LIKE patterns. T-SQL examples for email validation in SQL Server.

The Regex Pattern

Regex pattern

%[a-zA-Z0-9._%+-]%@%[a-zA-Z0-9.-]%.[a-zA-Z]%

Use this pattern with mssql's REGEXP operator.

mssql SQL Example

-- Use PATINDEX or LIKE patterns in SQL Server T-SQL to validate email address format in a users or contacts table
SELECT *
FROM your_table
WHERE your_column REGEXP '%[a-zA-Z0-9._%+-]%@%[a-zA-Z0-9.-]%.[a-zA-Z]%';

How This Works

Use PATINDEX or LIKE patterns in SQL Server T-SQL to validate email address format in a users or contacts table. The regex pattern is used with mssql's REGEXP operator to filter rows at the database level.

Using regex directly in SQL is efficient for use cases like data validation โ€” it avoids loading data into application memory just to filter it with a regex.

Need a custom SQL + Regex query?

Describe your specific use case in plain English. RegSQL generates the exact mssql query with the right regex pattern for your schema.

Related SQL Patterns