Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

We need to display the Employee name as a single "LastName, FirstName" column in our DataGrid.

 

In the Employee table, these columns are separate:

SELECT LastName, FirstName
FROM dbo.Employee

Is there a way to format an SQL command so that these two columns get merged? I'm looking for something like this:

SELECT (LastName, ", " FirstName) AS "EmployeeName" 
FROM dbo.Employee

Of course, that doesn't work!

Posted

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 can't?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...