字符串变量的空或空检查 [英] Null or empty check for a string variable

查看:59
本文介绍了字符串变量的空或空检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

if((isnull(@value,''))='')

我想知道上面这段代码在检查变量是否为空或为空时是否有效.

I want to know whether the above piece of code works in checking if the variable is null or empty.

推荐答案

是的,该代码正是这样做的.

Yes, that code does exactly that.

您也可以使用:

if (@value is null or @value = '')

使用 @valueint 值的附加信息,您需要:

With the added information that @value is an int value, you need instead:

if (@value is null)

int 值永远不能包含值 ''.

An int value can never contain the value ''.

这篇关于字符串变量的空或空检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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