Friday, 15 August 2014

tsql - SQL query, if value is null then return 1 -



tsql - SQL query, if value is null then return 1 -

i have query reutning exchage rate value set in our system. not every order have exchange rate (currate.currentrate) returning null values. can homecoming 1 instead of null. if statement maybe:

if isnull(currate.currentrate) 1 else currate.currentrate

here query below. appreciate help!

select orderhed.ordernum, orderhed.orderdate, currrate.currencycode, currrate.currentrate orderhed left outer bring together currrate on orderhed.company = currrate.company , orderhed.orderdate = currrate.effectivedate

you can utilize case statement.

select case when currate.currentrate null 1 else currate.currentrate end ...

tsql null ssms

No comments:

Post a Comment