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

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

Blessed1978
Yak Posting Veteran

74 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"))
END

is this correct



khtan
In (Som, Ni, Yak)

Singapore
17681 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



KH
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.03 seconds. Powered By: Snitz Forums 2000