如何在sqlserver中做到这一点 [英] How to do it in sqlserver

查看:115
本文介绍了如何在sqlserver中做到这一点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Table1 
Name       	Address
Alfon so desusa	23lane east south port
Barry richard	101suit north 
Harry	        51forest

How to achieve like below
Name	Address
Alfon	23lane
so	east
desusa	south
	port
Barry	101suit
richard	north  
Harry	51forest

推荐答案

不要尝试去做你想做的事情.
那不遵循第一个范式.

您可以做的是在表中有四列-每一列分别用于名字,中间名和姓氏,而另一列用于地址.使每个varchar都可以接受固定数量的字符.
Dont try and do what you are trying to do.
That does not follow first normal form.

What you can do instead is have four columns in your table - one each for firstname, middlename and lastname and one for the address. Make each of these varchar and make them can accept a fixed number of characters.


是的,正如Abhinav所说的,您可以尝试...

但是,您也可以在从数据库中获取字符串后尝试连接起来,并使用字符串函数来区分字符串中空格的位置...
Yes as Abhinav says you can try that...

But you can also try to concat your string after getting from the database and use a string function to distinguish your string where it get blank space...


这篇关于如何在sqlserver中做到这一点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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