469,167 Members | 1,256 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,167 developers. It's quick & easy.

simple problem, it's friday...

Here is what I need to accomplish

iif(len(sMemoText) > 15, left(sMemoText, 15) + '...', sMemoText)

How to convert this into a case or anyother way to get this into a
select statement...
Thanks MUCH!
Jeff

Jul 23 '05 #1
3 970
Ahh nevermind, I'll just do this in my databind on the application
side. I guess that will be much easier anyhow.
Hey, if you've got a SQL answer I'd still like to know. Thanks!
Jeff

Jul 23 '05 #2
LEFT(smemotext,15) + CASE WHEN LEN(smemotext)>15 THEN '...' ELSE '' END

Client-side is probably the better option.

--
David Portas
SQL Server MVP
--

Jul 23 '05 #3
CREATE TABLE #Fred (sMemoText VarChar(30) NULL)

INSERT INTO #Fred(sMemoText) VALUES ('abcdefghij')
INSERT INTO #Fred(sMemoText) VALUES ('abcdefghijklmnopqrstuvwxyz')

SELECT
sMemoText,
CASE WHEN Len(sMemoText) > 15
THEN REVERSE(STUFF(REVERSE(sMemoText),1,16,'...'))
ELSE sMemoText
END AS sMemoTextRevised

FROM
#Fred

DROP TABLE #Fred

Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Iain Miller | last post: by
11 posts views Thread by CK | last post: by
1 post views Thread by Ike | last post: by
4 posts views Thread by Steven M. O'Neill | last post: by
thatos
1 post views Thread by thatos | last post: by
risk32
5 posts views Thread by risk32 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.