Click here to Skip to main content
15,913,836 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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......
Posted
Comments
Deenuji 6-Dec-12 5:16am    
why u using 3 textbox for address???? u should use single textbox in multiline mode...that's enough.... u no need to use more than one....
shinju atholi 6-Dec-12 5:18am    
i know that... but i want to know the above also.
Deenuji 6-Dec-12 5:26am    
now it worked correctly????
shinju atholi 7-Dec-12 7:11am    
sry i didint check it....

1 solution

Try like this....

SQL
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)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900