Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | 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
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

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

is this correct



khtan
In (Som, Ni, Yak)

Singapore
17689 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  
 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.08 seconds. Powered By: Snitz Forums 2000