Hi not sure if this is possible so wanted some guidance..

I have a database with 3 columns..

id, data,timestamp

id is auto increment and data is json array and timestamp is unix timestamp..

the field I wanted to update was data but I wanted to replace just a part of it..

see sample data below
(id, data, timestamp)
(1, '{"Employee_Number":"235","First_Name":"Test","Middle_Name":"TEST2"}',1495120538)

I wanted to replace the 235 with 544 but I will not know what data there is in the data field .. I will only know the id

I tried

UPDATE table SET data= replace(data, '{"Employee_Number":"%","First_Name"', '{"Employee_Number":"544","First_Name"') WHERE id = '1'

but the issue is that % cannot be used as wildcard in replace..

Any suggestions will help

Thanks

Recommended Answers

All 3 Replies

ahh brill

does the field needs to be specific type? or varchar is ok?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.