SQL过程条件 [英] SQL Procedure condition

查看:69
本文介绍了SQL过程条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

请将此转换为SQL语句。



  if (NoOFAttempts)<  maxCaptcha)
{
message.Text = NoOFAttempts小于maxCaptcha;

}
else if (NoOFAttempts == maxCaptcha)
{
message.Text = NoOFAttempts 等于maxCaptcha ;
}
else if(NoOFAttempts> ; maxCaptcha)
{

if(Convert.ToInt32(NoOFAttempts> maxLock)
{

message.Text =
< span class =code-string> NoOFAttempts大于maxLock;


}
else
{
message.Text = NoOFAttempts Les比maxLock ;
}
}

解决方案

它应该是这样的:

  SELECT   CASE  何时 NoOFAttempts< maxCaptcha  THEN  '  NoOFAttempts小于maxCaptcha' 
WHEN NoOFAttempts == maxCaptcha 那么 ' NoOFAttempts为Equal maxCaptcha'
WHEN NoOFAttempts> maxCaptcha ' NoOFAttempts大于maxLock' END AS [消息]
FROM ...


Dear All,
Please convert this to SQL STATEMENT.

if (NoOFAttempts) < maxCaptcha)
        {
       message.Text = " NoOFAttempts is Less Than maxCaptcha";

        }
        else if (NoOFAttempts == maxCaptcha)
        {
            message.Text = "" NoOFAttempts is Equal maxCaptcha ";
        }
        else if (NoOFAttempts > maxCaptcha)
        {

            if (Convert.ToInt32(NoOFAttempts > maxLock)
            {
               
            message.Text = "" NoOFAttempts is greater than maxLock ";

                
            }
            else
            {
            message.Text = "" NoOFAttempts is Less  than maxLock ";
            }
        }

解决方案

It should be something like that:

SELECT CASE WHEN NoOFAttempts < maxCaptcha THEN 'NoOFAttempts is Less Than maxCaptcha'
            WHEN NoOFAttempts == maxCaptcha THEN 'NoOFAttempts is Equal maxCaptcha'
            WHEN NoOFAttempts > maxCaptcha 'NoOFAttempts is greater than maxLock' END AS [Message]
FROM ...


这篇关于SQL过程条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆