Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
reading2009
Starting Member
22 Posts |
Posted - 2009-12-29 : 14:22:33
|
Hi,I am looking for copy data from one column from one table(1st) to another column in the 2nd table.But I want the out in the 2nd table in a particular way.ColumnA in 1st tableabcdefghidgyDesired output in 2nd tableColumnBabc,def,ghi,dgyI tried INSERT INTO TestTable (FirstName, LastName)SELECT FirstName, LastNameFROM Person.Contactbut i get the output same as 1st table.Any help here.... |
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-12-29 : 14:29:54
|
Can you provide some more information..table structures??So you have a single column (probably FullName) in table 2 and you want to insert the value "FirstName,LastName" from table 1 into this new column in table2? |
|
|
reading2009
Starting Member
22 Posts |
Posted - 2009-12-29 : 14:42:33
|
Yes, you are right. I want different rows in coulmn a in 1st table to appear in 1 row, comma seperated values in column b of second table. |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-12-29 : 15:06:17
|
Have a look at this topic to see how to concatenate without a UDF.http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254 |
|
|
reading2009
Starting Member
22 Posts |
Posted - 2009-12-30 : 09:42:04
|
Thank you. I will go through your material today and give it a try. |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-12-30 : 10:01:30
|
You're welcome. Post back if you face any difficulties (along with sample data this time ). |
|
|
|
|
|