Skip to content
Advertisement

Converting db2 column names in select to be lowercase in json file

I currently have a very simple select that my code then dumps into JSON

SELECT user, phone
FROM table t;

But the select returns all uppercase column names, resulting in uppercase JSON keys, which I don’t want. Is there a way in DB2 to return lowercase column names?

Advertisement

Answer

If you want to get lowercase columns names (not data) in DB2, you must use double quotes around the column names.

SELECT user as "user", phone as "phone"
FROM table t;
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement