将来自多个控件的数据保存到表的单个列中....
问题描述:
我有3个文本框用于填写地址。在填写文本框后,我必须将该数据存储到逐行排序的表中的单个列中。看到底部...
没有名字地址
1 anu no 96
iti布局
mg路
banglore
请帮帮我......
I have 3 text boxes for filling address. After filling the text boxes i have to store that data into a single column in the table ordered line by line. see the bottom section...
no name address
1 anu no 96
iti layout
mg road
banglore
please help me......
答
试试这样....
Try like this....
declare @interest table (id int identity not null, ColA varchar(10) null, ColB varchar(10) null, ColC varchar(10) null)
insert into @interest (ColA, ColB, ColC)
values
(null, null, '1.1%')
,('3.2%', '1.1%', '2.0%')
declare @description table (id int identity not null, NewColumn varchar(30))
insert into @description (NewColumn)
(select coalesce(ColA,'0.0%')+', '+coalesce(ColB, '0.0%')+', '+coalesce(ColC,'0.0%')
from @interest)
select * from @description
(2 row(s) affected)
(2 row(s) affected)
id NewColumn
----------- ------------------------------
1 0.0%, 0.0%, 1.1%
2 3.2%, 1.1%, 2.0%
(2 row(s) affected)