如何显示包含名字和姓氏的全名 [英] How to display full name combining first name and last name
本文介绍了如何显示包含名字和姓氏的全名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要通过组合名字和姓氏以及名字和姓氏之间的空格来显示全名.我尝试了以下代码.
I need to display full name by combining first name+last name with space between first name and last name. I tried the following code.
declare @sql varchar(1000)
set @sql=''select tblUsers.strFirstName''+ ''+'' +''tblUsers.strLastName as ''''fullName'''' from tblUsers''
exec(@sql)
但是我得到的输出为TonyIssac,两个单词之间没有空格.我该如何实现?
But I am getting output as TonyIssac without space between two words. How can I achieve this?
推荐答案
尝试:
-- Name with a space
set @sql='select tblUsers.strFirstName'+ '+' + ' ' + '+' + 'tblUsers.strLastName as ''fullName'' from tblUsers'
或
OR
-- Name with a comma
set @sql='select tblUsers.strFirstName'+ '+' + ',' + '+' + 'tblUsers.strLastName as ''fullName'' from tblUsers'
这篇关于如何显示包含名字和姓氏的全名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文