Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 what is wrong with this code?

Author  Topic 

jeff06
Posting Yak Master

166 Posts

Posted - 2007-07-17 : 08:33:21
[code]tickets = case when mrc.averageticket=null or mrc.averageticket=0, null, mccv.mccvamount/mrc.averageticket
end
[/code]

Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-07-17 : 08:35:40
SELECT CASE WHEN NULLIF(mrc.averageticket, 0) IS NULL THEN NULL ELSE 1.0 * mccv.mccvamount / mrc.averageticket END AS Tickets




Peter Larsson
Helsingborg, Sweden
Go to Top of Page

jeff06
Posting Yak Master

166 Posts

Posted - 2007-07-17 : 08:56:32
Thanks
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-07-17 : 09:58:28
quote:
Originally posted by jeff06

tickets = case when mrc.averageticket=null  or mrc.averageticket=0, null, mccv.mccvamount/mrc.averageticket
end


Thanks

You are simulating ACCESS's IIF function

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -