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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

(T-Sql) NULL population 1

Status
Not open for further replies.

markajem

Programmer
Dec 20, 2001
564
US
The code below works fine if sopnumbe is null it then uses order_num and populates master_sop_num with order_num. But I am also trying to achieve the reverse. If order_num is null then use sopnumbe and populate master_sop_num. I am not too go with syntax.

Thanks, much appreciated.


Code:
select
	case
	when sopnumbe is null
	then cast(order_num as char(21))
	else sopnumbe
	end as master_SOP_Num,
 
Select Coalesce(sopnumbe, order_num) As master_SOP_Num

Lookup the coalesce function in Books On Line.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
That did it George. I will look it up.

Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top