如何在sqlserver中分割字符串 [英] how to split string in sqlserver
本文介绍了如何在sqlserver中分割字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我只想知道
如何在sqlserver中分割字符串"
Hi to all,
just i want to know
"how to split string in sqlserver"
推荐答案
Google是您的朋友:很好,经常拜访他.与在这里发布问题相比,他可以更快地回答问题.
使用您的主题作为搜索词 进行的快速搜索 带来了超过200万次匹配: ^ ]
第二个链接提供了完整的SQL功能: http://www.devaffair. com/2011/09/split-string-in-sql-server.html [
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...
A very quick search using your subject as the search term gave over 2 million hits: https://www.google.co.uk/search?q=how+to+split+string+in+sqlserver&sugexp=chrome,mod=10&sourceid=chrome&ie=UTF-8[^]
The second link gives a fully working SQL function: http://www.devaffair.com/2011/09/split-string-in-sql-server.html[^]
In future, please try to do at least basic research yourself, and not waste your time or ours.
您好,
您可以使用SUBSTRING
在Sql Server中拆分字符串.
请参考以下链接:
MSDN:SUBSTRING(Transact-SQL) [ MSDN:SUBSTRING(Transact-SQL)-2 [ ^ ]
MSDN:SUBSTRING [
Hi,
You can useSUBSTRING
to split your strings in Sql Server.
Refer the links below:
MSDN : SUBSTRING (Transact-SQL)[^]
MSDN : SUBSTRING (Transact-SQL)-2[^]
MSDN : SUBSTRING[^]
--All the best.
create table temp
(id varchar(50))
insert into temp values ('10/2000')
insert into temp values ('5/2000')
insert into temp values ('345/2000')
select SUBSTRING(id,1,charindex('/',id,0)-1) as id,
SUBSTRING(id,charindex('/',id,0)+1,LEN(id)-1) as year from temp
这篇关于如何在sqlserver中分割字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文