SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

97 Posts

Posted - 03/20/2014 :  21:15:09  Show Profile  Reply with Quote
I would like to find the last 5 characters on a column based upon a join I wrote. when it finds anything that matches the word "color" WHICH is 5 characters long it should rename it to "color". else "b&W". So the table may have a column name "print monitor color" or fax copier.

CASE SUBSTRING(left(me.name , 5) = "color" then "color" else "B&W"))

is this correct

In (Som, Ni, Yak)

17684 Posts

Posted - 03/20/2014 :  23:49:13  Show Profile  Reply with Quote
CASE WHEN RIGHT(me.name , 5) = 'color' then 'color' else 'B&W' END

Time is always against us

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000