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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Selecting and combining fields...

Author  Topic 

interclubs
Yak Posting Veteran

63 Posts

Posted - 2003-07-15 : 15:31:06
I have a table that has a FirstName and a LastName field, I am trying to figure out some way to combine them in a select...so it would be something like this:

(Select FirstName, LastName from User_Profile) as UserName

But I would want it to combine the two, and add a space in between them. i.e. FirstName + ' ' + LastName as UserName

Is this possible?

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2003-07-15 : 15:36:01
Yep.

select firstname+' '+lastname as username from user_profile

Jonathan
{0}
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-07-15 : 15:37:45
SELECT FirstName + ' ' + LastName AS UserName
FROM user_profile

Tara
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-07-15 : 15:38:46
Damn, Jonathan beat me to it.

Tara
Go to Top of Page

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2003-07-15 : 15:43:10
My sub-1000 post count needs padding ...

Jonathan
{0}
Go to Top of Page
   

- Advertisement -