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)
 IIF(len(fld1)>5,left(fld1,5) + '...', fld1)

Author  Topic 

ASP_DRUG_DEALER
Yak Posting Veteran

61 Posts

Posted - 2004-06-30 : 15:44:00
Anyone got a cool way of doing this? I really would like to do this in my stored procedure.



SELECT
CO_ID, (IIF (LEN(CO_DESC) < 22), CO_DESC, (LEFT(CO_DESC,22) + '...')) AS COURSENAME
--CO_ID, ('(' + CO_ID + ') ' + LEFT(CO_DESC,22) + '...') AS COURSENAME
FROM
COURSE
WHERE (CO_ACTIVE = 'A') ORDER BY CO_ID;

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-06-30 : 15:49:50
You can use CASE in a SELECT statement.

Tara
Go to Top of Page
   

- Advertisement -