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 |
chbala85
Starting Member
49 Posts |
Posted - 2013-07-11 : 08:10:03
|
Hi all,i have table it's having 10 columns.Here fisrtname ,lastname column need to concat and stored to fullname column but lastname some times having null values also.That fullname column data to insert into another table test2. Heere fullname column datatype is varchar.help me..............best regards,krsh. |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-07-11 : 08:11:49
|
[code]INSERT INTO YourNewTable (FullName)SELECT COALESCE(FirstName + ' ','') + COALESCE(LastName,'')FROM YourOriginalTable[/code] |
|
|
MuMu88
Aged Yak Warrior
549 Posts |
Posted - 2013-07-11 : 08:44:53
|
Or If you SQL 2012 you can do this:[CODE]INSERT INTO YourNewTable (FullName)SELECT CONCAT(FirstName + ' ', LastName)FROM YourOriginalTable[/CODE] |
|
|
|
|
|