Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: SQL-server-2005
Hi Frnds,
How to combine columns.I have FirstName,MiddleName,LastName in Registration Form.I Used this Query
select FirstName+' '+MiddleName+' '+LastName from RegistrationTable ...
Here Middle Name is Null Also.At that time Select Query showing null value if First and Last Name Present Also.At that time i used ISNULL(MiddleName,''),but at that time two spaces should not show in between FirstName and LastName.
Posted 24-Dec-12 3:10am
Edited 24-Dec-12 3:14am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

SELECT RTRIM(FirstName + ' ' + ISNULL(MiddleName, '')) + ' ' + LastName FROM RegistrationTable
itsureshuk at 24-Dec-12 9:38am
OriginalGriff at 24-Dec-12 9:55am
You're welcome!

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

  Print Answers RSS
Your Filters
0 Sergey Alexandrovich Kryukov 680
1 OriginalGriff 379
2 Manas Bhardwaj 350
3 Abhinav S 293
4 Sampath Lokuge 245
0 Sergey Alexandrovich Kryukov 7,647
1 OriginalGriff 4,287
2 Peter Leow 3,681
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107

Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 24 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid