From: littleccguy on
Using SQL 2000 and 2005 servers

We have a view that pulls the proj_name from the MS Project server.
It sometimes includes .Published at the end of the name.

Is there a way to trim a specific value from the end of the string?

Thanks,

littleccguy
From: Aaron Bertrand [SQL Server MVP] on
One way...

SELECT proj_name = CASE
WHEN proj_name LIKE '%.Published' THEN
LEFT(proj_name, LEN(RTRIM(proj_name))-11)
ELSE proj_name
END
FROM ...



"littleccguy" <tonkasanders(a)comcast.net> wrote in message
news:455e708b-8653-461e-8c0b-4afcc9119761(a)f63g2000hsf.googlegroups.com...
> Using SQL 2000 and 2005 servers
>
> We have a view that pulls the proj_name from the MS Project server.
> It sometimes includes .Published at the end of the name.
>
> Is there a way to trim a specific value from the end of the string?
>
> Thanks,
>
> littleccguy


From: littleccguy on
Thanks Aaron - perfect!