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)
 First X characters of description

Author  Topic 

adlo
Posting Yak Master

108 Posts

Posted - 2004-09-16 : 13:04:58
I need to write a query that gets a list of positions with their details.

Table Position
-Position_ID
-PositionName
-Description varchar(1000)

Here is the problem:
If the length of the description is 20 characters or less it must display the whole description.

If the length of the description is more than 20 characters it must display the first 17 characters followed by '...'


spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-09-16 : 13:09:23
select Position_ID, PositionName,
case when len(Description )>20 then left(Description , 17)+'...' else Description end as Description
from Position

Go with the flow & have fun! Else fight the flow
Go to Top of Page

adlo
Posting Yak Master

108 Posts

Posted - 2004-09-17 : 05:23:26
Thanks
Go to Top of Page
   

- Advertisement -