How to print or select specific rows in SQL

I want to print only the data that starts with a number from a SQL string column. Right now its printing complete string (see image). I only want row 2 and 4 as it contains the data starting with a number. Here is the sql code:

DECLARE @string2 VARCHAR(MAX) 
SET @string2 ='DOB;04 Mar 1199;passport;1234567'
DECLARE @SEP CHAR(1) 
SET @SEP=';'
select @string2
SELECT value
FROM   STRING_SPLIT(@string2, @sep)

enter image description here


Solution 1:

You can try this query:-

SELECT * FROM TableName WHERE ColumnName regexp '^[0-9]+'

The above is MySQL specific.

You can use the below query on SQL Server: Example tested on W3schools

Solution 2:

You can use the value in the where clause. So using the SUBSTRING and the ISNUMERIC functions should solve your problem.