Merging SQL Columns for display

joe_pool_is

Well-known member
Joined
Jan 18, 2004
Messages
451
Location
Texas
We need to display the Employee name as a single "LastName, FirstName" column in our DataGrid.

In the Employee table, these columns are separate:
Code:
SELECT LastName, FirstName
FROM dbo.Employee
Is there a way to format an SQL command so that these two columns get merged? Im looking for something like this:
Code:
SELECT (LastName, ", " FirstName) AS "EmployeeName" 
FROM dbo.Employee
Of course, that doesnt work!
 
Wow! I got a reply from the Master! :)

I ran the code your way on the SQL Server through the Enterprise Manager GUI, and it worked fine.

However, whenever I tried using it in VS, I got the message "Incorrect syntax near the keyword AS."

Is there any reason why SQL Server can run this but VS cant?
 
Back
Top