Format wants to capitalize the OPENJSON "key" column to "Key"
Number2
Posts: 4 New member
in SQL Prompt
I can't for the life of me find out how to stop SQL Prompt from formatting the built-in column name of "key" (must be all lower-case in my BIN2 collation for it to work) to the camel-case "Key" when I'm using a SELECT [key] FROM OPENJSON(). Is this a bug?
Tagged:
Answers
Just to check, have you tried turning off the formatting option under Global > Casing > User-defined objects > Use object definition case? I think that the Key and Value columns are declared as camel-case.
If this doesn't help then let me know!
Thanks,
James
Redgate Software
DECLARE @json NVARCHAR(4000)
= N'{
"key":1,
"name" : { "firstname":"Steve", "lastname":"Jones"} ,
"Employer":"Redgate",
"Sites":{ "primary":"SQLServerCentral", "secondary":"tsqltuesday.com"}
}'
;
SELECT [key] FROM OPENJSON(@json) AS oj
;
So, with USER-DEFINED OBJECTS -> USE OBJECT DEFINITION CASE as UNCHECKED, the CTRL+K, CTRL+Y formatting does NOT exhibit this problem, but the TAB expansion of columns where it replaces text as you're typing, that DOES still camel case it for me.
Version 8.0.11.2296