TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
First Name + Middle Name + Last Name Merge With One Extra Space
Ashish Srivastava
Aug 27
2016
Code
2.1
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
Create
FUNCTION
[dbo].[GetFullNameWithNoSpace]
(
@First_Name
varchar
(50),
@Middle_Name
varchar
(50),
@Last_Name
varchar
(50)
)
RETURNS
Varchar
(152)
AS
begin
Declare
@outTime
Varchar
(152);
SELECT
@outTime=
REPLACE
(RTRIM(
COALESCE
(@First_Name +
' '
,
''
) +
COALESCE
(@Middle_Name +
' '
,
''
) +
COALESCE
(@Last_Name+
' '
,
''
) ),
' '
,
' '
)
RETURN
@outTime
END
GO
SELECT
dbo.[GetFullNameWithNoSpace](
'ashish'
,
''
,
'Srivastava'
)
SQL Server