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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to get concatenated values of all the columns

Author  Topic 

ccanoh0000
Starting Member

1 Post

Posted - 2012-02-19 : 13:02:32
Hello

Here is my query

INSERT INTO CUSTOMER
FIRST as F_NAME,
LAST as L_NAME,
ADDRESS AS ADDRESS,
FIRST+LAST+ADDRESS AS ALL_DETAILS

FROM
(SELECT * FROM USER)

This is what I tried but the line 'FIRST+LAST+ADDRESS AS ALL_DETAILS' gives and error. How can I achieve this?

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-02-19 : 15:03:40
You shouldn't be storing the concatenated value in the database, but here you go:

INSERT INTO CUSTOMER
SELECT FIRST, LAST, ADDRESS, FIRST+LAST+ADDRESS
FROM USER

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -