How to tokenize a string and assign tokens to column in Teradata?

眉间皱痕 提交于 2019-12-13 18:33:32

问题


I have multiple strings of the form {key1=value, key2=value2, key3=value3 ...} with a known set of keys. The key names are set and known, with only the values changing between records. I would like to tokenize the string with the space delimiter as my tokenizing character then strip off the key names and assign each one to a column in sequential order. Is this something I can do in-database in teradata 15?


回答1:


Starting with TD14 there's NVP to extract data from name-value-pairs, e.g.

NVP(col, 'key1', '{ ,\  }', '=') 


来源:https://stackoverflow.com/questions/31925691/how-to-tokenize-a-string-and-assign-tokens-to-column-in-teradata

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!