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
 General SQL Server Forums
 New to SQL Server Programming
 Select Query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

goodman2253
Yak Posting Veteran

86 Posts

Posted - 09/08/2013 :  01:29:59  Show Profile  Reply with Quote
Hello All,

I am using the select query as below
Select country from table1 which give the output as
COUNTRY
US
USA
UK
Malaysia
France
Europe
US
USA

I want to change whenever US comes it change to USA. So the output should be as below-:

COUNTRY
USA
USA
UK
Malaysia
France
Europe
USA
USA

tkizer
Almighty SQL Goddess

USA
37133 Posts

Posted - 09/08/2013 :  02:10:03  Show Profile  Visit tkizer's Homepage  Reply with Quote
select country=case when country='us' then 'usa' else country end from table1

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

goodman2253
Yak Posting Veteran

86 Posts

Posted - 09/08/2013 :  02:45:08  Show Profile  Reply with Quote
any function like regexp_replace. Because using case make the sql query execute very slow. For one case its fine, but If I have to use multiple then. I hope you understand my point
Go to Top of Page

tkizer
Almighty SQL Goddess

USA
37133 Posts

Posted - 09/08/2013 :  14:49:29  Show Profile  Visit tkizer's Homepage  Reply with Quote
Case will not make this query run slow even if you add multiples. If you are having slowness on a particular query, then please post THAT query plus the indexes and execution plan.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
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