I have a VARCHAR Column called CompanyInformation that contains some Json data inside of it, here is a example of what is being stored inside of this column.
{
"tradeName": "example",
"corporateName": "example",
"phone": "example",
"nationalExpansions": [
{
"id": 0,
"nameFranchise": "example",
"phoneNumber": "example",
"mobileNumber": "example",
"email": "example@example.com.br"
},
{
"id": 0,
"nameFranchise": "example",
"phoneNumber": "example",
"mobileNumber": "example",
"email": "example"
},
What i have to do is replace all emails inside of this file to one specific email, i was trying to use the REPLACE
function to do that, but i don`t know exactly how to do pattern matching in SQL.
UPDATE MyExampleTable SET CompanyInformation = REPLACE(CONVERT(VARCHAR(MAX), CompanyInformation), '"email": "%%"', '"email": "tests@gmail.com.br"')
But it doesn't work, the UPDATE gets executed, but he never replace the email information because he doesn't find any matching pattern.