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
 SQL Server Development (2000)
 Query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-04-08 : 08:31:53
Michael writes "I'm new to SQL moving over from Access. I've got a table that contains employees deatils, forename, surname and known_as. What I'd like to do is create a query that shows a column for forname that contains known_as if >0 else forename, and a column that contains full name I've created a query for this already.
SELECT *,
CASE
WHEN LEN(Known_as) = 0 THEN forename + ' ' + surname
ELSE Known_as + ' ' + surname
END AS Name
from Names

Can this be done"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-04-08 : 09:19:21
yes you can use. Did you run this?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -