Convert Sum(IIf statement) to T-SQL

I have an Access SQL query I'd like to convert to a stored procedure in SQL Server 7.  I'm pretty sure it requires a case when statement, but I'm stuck!

How can I translate this statement to t-sql?

Sum(IIf(IsNull(table.field),1,0)) as SumOfEmptyField

Thanks much!
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

simonsabinConnect With a Mentor Commented:
Sorry to steal the thunder but here you go

Sum(CASE WHEN table.field IS NULL THEN 1 ELSE 0 END)
create a view , which has the case statement, and then a stored procedute which uses this view in stead of the table
tradenutAuthor Commented:
my main problem is wording the case statement.
Can you give a small example?
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

select t=case type
               when 1 then 'OK'
               when 2 then 'Not OK'
         else 'Unknown'

there are a lot of examples in books online - the help of SQL Server
tell me what exactly what you want to do if you want more specific help

its ok simonsabin
you have the correct answer
tradenutAuthor Commented:
Thanks to you both for the help.

Wish I could distribute points..  =)
All Courses

From novice to tech pro — start learning today.