如何标记字符串并将标记分配给 Teradata 中的列? [英] How to tokenize a string and assign tokens to column in Teradata?

查看:21
本文介绍了如何标记字符串并将标记分配给 Teradata 中的列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有多个 {key1=value, key2=value2, key3=value3 ...} 形式的字符串,带有一组已知的键.键名已设置并已知,只有值在记录之间发生变化.我想用空格分隔符标记字符串作为标记字符,然​​后去掉键名并按顺序将每个键名分配给一列.这是我可以在 teradata 15 中在数据库中执行的操作吗?

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?

推荐答案

从 TD14 开始,有 NVP 可以从名称-值对中提取数据,例如

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

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

这篇关于如何标记字符串并将标记分配给 Teradata 中的列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆