Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatinating in a select statement

Status
Not open for further replies.

jeepxo

Programmer
Oct 1, 2002
228
CA
I need to make a comma delimited file with a select statement.

The select is basically pretty simple with one hitch. In the database I have last name and First name stored as separate fields, but I need them as a single field in the file.

So, basically is there a way to say "select (cyb_first_name, cyb_last_name) as name" so that the first name and lastname are concatinated together as a single column?

"Every day is like a precious gift, you have to make it count" James Birrell 1993-2001
 
SELECT FirstName + ' ' + LastName AS name
FROM Table

Thanks

J. Kusch
 
Try this, note I changed the alias to fullname. Name is a reserved word. If you must use name, put it in brackets [name]

SELECT (cyb_first_name + ',' + cyb_last_name) AS fullname

-SQLBill
 
select (cyb_first_name + ',' + cyb_last_name) as fullname should work
 
Boy do I feel stupid now.

Thanks guys.

"Every day is like a precious gift, you have to make it count" James Birrell 1993-2001
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top