Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 concat query
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

49 Posts

Posted - 07/11/2013 :  08:10:03  Show Profile  Reply with Quote

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,


James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 07/11/2013 :  08:11:49  Show Profile  Reply with Quote
INSERT INTO YourNewTable (FullName)
SELECT COALESCE(FirstName + ' ','') + COALESCE(LastName,'')
FROM YourOriginalTable
Go to Top of Page

Aged Yak Warrior

549 Posts

Posted - 07/11/2013 :  08:44:53  Show Profile  Reply with Quote
Or If you SQL 2012 you can do this:

INSERT INTO YourNewTable (FullName)
SELECT CONCAT(FirstName + ' ', LastName)
FROM YourOriginalTable
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000