How can I change the column name "JSON_F52......" to Any(e.g. SalesOrder)
You can use the UPDATE statement to modify values of a JSON column in the SET clause. You can only update the JSON column, not individual portions of the JSON instance. Also, when referencing a JSON column in its entirety, the input format is the same as the INSERT statement. MERGE.
Select and right-click on a table or a column you want to rename and click Rename. Enter a new name by over writing on existing name. Go to the file menu and click Save.
Use SQL Server Management StudioIn Object Explorer, right-click the table in which you want to rename columns and choose Rename. Type a new column name.
Now, SQL Server also supports the JSON format. There is no specific data type for JSON SQL Server like XML. We need to use NVARCHAR when we interact with JSON. There are many built-in functions available with SQL Server 2016, such as ISJSON, JSON_VALUE, JSON_QUERY, JSON_MODIFY, OPENJSON, and FOR JSON.
Wrap your json building SELECT in another SELECT:
SELECT (
SELECT SalesOrderNumber AS 'Order.Number',
OrderDate AS 'Order.Date'
FROM Sales.SalesOrderHeader
FOR JSON PATH
) AS SalesOrder
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With