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

if/else in SQL

Status
Not open for further replies.

Ali29J

Technical User
May 13, 2004
203
GB
Hi All

I am trying to use SQL to run a calculation, at the moment it is:

calculatedtotal2: [QuoteFinish]-[QuoteStart]

but i would like in if/else statement, if [QuoteFinish] is null then

calculatedtotal2: [todaysdate??]-[QuoteStart]

So in VB code it would be:

if isnull(me.quotefinish.value) then
calculatedtotal2 = [Date()]-[QuoteStart]
else
[QuoteFinish]-[QuoteStart]

is this possible in SQL? or can anyone assist in converting ths above to SQL not sure on SQL coding...

Thanks

Ali
 
calculatedtotal2: Nz([QuoteFinish],Date())-[QuoteStart]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top