I have a database (MS SQL) with a column that contains a query string. I want to take that query string and move it into a column that stores some settings in Json.
I could manually do this if it was only a few columns in one database, but this is part of a major upgrade that will be pushed out to over 50 sites. I’d like to have a T-SQL script that I could run on every database to perform this task for me.
Here’s a sample of what the data will look like in the first column (as a query string):
KEY1=VALUE1&KEY2=VALUE2
I’d like to format that like so:
{"KEY1":"VALUE1","KEY2":"VALUE2"}
I’d appreciate any ideas you can throw my way!
Maybe you can use this
of course @x is your column I was testing with @x = N’KEY1=VALUE1&KEY2=VALUE2′