我在雪花中的桌子上有一个名为“ A”的列。在此列中,我具有诸如“杂货店”,“邮局”,“ nordstromrackstore”
等的值。这些值当前在骆驼案中,但我想更改它们,以便它们遵循格式“ grocery_store”,“ post_office”,“ nordstrom_rack_store”
等。有没有办法将值更改为所有大写,并在此中被一个下划线隔开的单词?我不确定如何将Regex用于骆驼盒格式。或者,或者甚至可以将结果格式更改为骆驼案例?如Change 中的“ Grocery_store”
“杂货店” ?谢谢!
I have a column in my table in Snowflake called "A". In this column I have values such as "groceryStore", "postOffice", "nordstromRackStore"
etc. The values are currently in camel case but I would like to change them so that they follow the format "GROCERY_STORE", "POST_OFFICE", "NORDSTROM_RACK_STORE"
and so on. Is there a way to change the values to be all uppercase and have the words separated by an underscore in this? I'm not sure how to use regex for camel case format. Or even alternatively, is there a way to change the result format into camel case? As in change "GROCERY_STORE"
to "groceryStore"
? Thanks!
发布评论
评论(1)
它(
Regexp_replace
),除非我缺少问题中的某些内容。数据
替换
It (
REGEXP_REPLACE
), seems to work, unless I am missing something in the question.Original data -
After replace -