Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing values to a value a i need

Status
Not open for further replies.

sandeep0000

Programmer
May 10, 2007
98
US
i am gettting some extracts that are uploaded to our database

problem is

in the extract a program type code is (cw, rc) and others but they are fine
but my main table CR is used instead of cw or rc.

so how can i change the codes taht come in my extract (cw,rc) to change to CR. can i do this when i link the tables in my query.

im using sql server
 
basicall i want to link these two tables

P.Program_type_Code = cp.PGM_TYP_CD

but when i link the tables i need tell it that p.Program_type_Code (cw,rc to change to CR)

the rest of the values are fine
 
Hi,

You probably need to use a CASE statement.

Code:
SELECT CASE WHEN p.Program_type_code = 'cw' OR p.Program_type_code = 'rc' THEN 'CR' ELSE p.Program_type_code END AS 'Program_type_code'
FROM...

HOpe this helps.

Cheers,
Leigh

"If you had one shot, one opportunity, to seize everything you ever wanted, in one moment, would you capture it, or let it slip?" - Eminem

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top