By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE DataTableOne (
ID int,
DATA varchar(MAX)
);
INSERT INTO DataTableOne (ID, DATA)
VALUES (1, '{"name":"Cole", "update_date":"2855290000"}'),
(2, '{"name":"Peter", "update_date":"1222290000"}') ;
2 rows affected
SELECT
DTO.*
FROM dbo.DataTableOne AS DTO
CROSS APPLY
(
SELECT
TRY_CONVERT(xml,
REPLACE(
REPLACE(
REPLACE(
REPLACE(DTO.[DATA],
'"name":', 'name='),
', "update_date":', ' update_date='),
'{', '<r '),
'}', '/>'))
) AS X (x)
WHERE
1 = X.x.exist('r[1][@update_date ge 1645290000]');
ID | DATA |
---|---|
1 | {"name":"Cole", "update_date":"2855290000"} |
SELECT *
FROM dbo.DataTableOne AS DTO
WHERE
DTO.[DATA] COLLATE Latin1_General_BIN2
LIKE '%"update_date":"164529[0-9][0-9][0-9][0-9]"%'
OR DTO.[DATA] COLLATE Latin1_General_BIN2
LIKE '%"update_date":"1645[3-9][0-9][0-9][0-9][0-9][0-9]"%'
OR DTO.[DATA] COLLATE Latin1_General_BIN2
LIKE '%"update_date":"164[6-9][0-9][0-9][0-9][0-9][0-9][0-9]"%'
OR DTO.[DATA] COLLATE Latin1_General_BIN2
LIKE '%"update_date":"16[5-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"%'
OR DTO.[DATA] COLLATE Latin1_General_BIN2
LIKE '%"update_date":"1[7-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"%'
OR DTO.[DATA] COLLATE Latin1_General_BIN2
LIKE '%"update_date":"[2-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"%';
ID | DATA |
---|---|
1 | {"name":"Cole", "update_date":"2855290000"} |