Jump to content
Fórum Script Brasil
  • 0

ERRO EM CONSULTA


Nelson Cruz

Question

Pessoal sou muito novato em banco de dados, e estou com um problema.

Tenho uma consulta feita, porem quando o resultado é NULL da erro na minha página asp. gostaria de saber como deve acertar isso na minha procedure.

SELECT     tbmotivousuario.login_oper, tbmotivousuario.nome_oper,  
        CASE WHEN (tbMotivoUsuario.[Tempo Total])<> '' THEN (SUM(dbo.ConvertParaSegundos(tbMotivoUsuario.[Tempo Total])/dbo.ConvertParaSegundos(tbusersdepart.ativos))) * 100 ELSE 0 END AS [TELIGO], tbmotivousuario.data
            FROM        tbmotivousuario with(nolock) RIGHT OUTER JOIN
                 tbusersdepart ON tbMotivoUsuario.login_oper = tbusersdepart.login_oper AND tbusersdepart.data = tbmotivousuario.data
        WHERE      (tbmotivousuario.data BETWEEN '08/08/2011' and '08/10/2011') AND (tbmotivousuario.[motivo do estado] = 'Pausa - Teligo Inop -TNO') 
        AND (tbmotivousuario.login_oper in ('P514782', 'P521237','P564764', 'P602979'))
        GROUP BY tbMotivoUsuario.login_oper, tbMotivoUsuario.nome_oper, tbmotivousuario.data, tbMotivoUsuario.[Tempo Total]
        )PAUSA_TELIGO_INOP
) PAUSA_TELIGO_INOP ON tblogon_logoff.login_oper = PAUSA_TELIGO_INOP.login_oper AND tblogon_logoff.data = PAUSA_TELIGO_INOP.data

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...