Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OrderId Name JSON
- {
- "Property1" :"",
- "Property2" :"",
- "metadata-department": "A",
- "metadata-group": "B"
- }
- declare @string varchar(1000) =
- '{
- "Property1" :"",
- "Property2" :"",
- "metadata-department": "A",
- "metadata-group": "B"
- }'
- select SUBSTRING(@string, 0, CHARINDEX('"metadata-department"',@string)) + SUBSTRING(@string, CHARINDEX('"metadata-group"', @string), len(@string))
- {
- "Property1" :"",
- "Property2" :"",
- "metadata-group": "B"
- }
- UPDATE TableX
- SET JSON =
- SUBSTRING(JSON, 0, CHARINDEX('"metadata-department"',JSON)) + SUBSTRING(JSON, CHARINDEX('"metadata-group"', JSON), len(JSON))
- DECLARE @Text NVARCHAR(MAX) = '{
- "Property1" :"",
- "Property2" :"",
- "metadata-department": "A",
- "metadata-group": "B"
- }';
- PRINT dbo.RegExReplace(@Text, '"metadata-department": "[A-Za-z0-z]",rns+', '');
- {
- "Property1" :"",
- "Property2" :"",
- "metadata-group": "B"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement