我如何使用Sql解决这个问题? [英] How Do I Solve This Using Sql ?
本文介绍了我如何使用Sql解决这个问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SL NAME NUMBERID
1 AAAA 10SET123452
如何拆分此号码成为部分,比如我希望它分开像
how can i split this number into parts, like i want it to separate like
SL NAME AA BB CC
1 AAAA 10 SET1 23452
有谁可以帮我这个?
Can anyone help me with this ?
推荐答案
你可以将numberid分成3部分使用字符串函数 [ ^ ]。根据您的需要,您必须使用LEFT,SUBSTRING和RIGHT功能。
假设您想获得固定长度的部件:
You can split numberid into 3 parts using string functions[^]. Depending on your needs, you have to use LEFT, SUBSTRING and RIGHT functions.
Let's say you want to get fixed length parts:
SELECT LEFT(NUMBERID, 2) AS AA, SUBSTRING(NUMBERID, 3, 4) AS BB, RIGHT(NUMBERID, 5) AS CC
FROM YourTableName
简单使用子字符串方法对于Mor帮助单击此处
Simple use substring method For Mor Help Click Here
SELECT LEFT(roll, 2) AS AA , SUBSTRING(roll,3, 4) AS BB, RIGHT(roll, 5) AS CC from test
这篇关于我如何使用Sql解决这个问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文