Theme:
How can I use Regex in SQL?
I need to use Regex in SQL to check space. Do you how can I do this?
Date: Monday, February 6, 2023
1 answers |
349 view(s)
by Mauricio Junior
Answers
You can use this... follow the code.
CREATE TABLE #Sample(Field varchar(50), Result varchar(50))
GO
INSERT INTO #Sample (Field, Result) VALUES ('ABC123 ', 'Do not match')
INSERT INTO #Sample (Field, Result) VALUES ('ABC123.', 'Do not match')
INSERT INTO #Sample (Field, Result) VALUES ('ABC123&', 'Match')
SELECT * FROM #Sample WHERE Field LIKE '%[^a-z0-9 .]%'
GO
DROP TABLE #Sample
Monday, February 6, 2023
Mauricio Junior