我正在尝试测试变量的值是否可以转换为数值.
I'm trying to test whether the value of the variable can be converted to a numeric value.
DECLARE @var1 VARCHAR(50)
SET @var1 = '1'
IF(ISNUMERIC(@var1) = 1)
BEGIN
PRINT 'It's numeric'
END
到目前为止,我什么都不赌.我错过了什么吗?
So far, I'm betting nothing. Am I missing anything?
您的打印语句中存在引用问题
you've got a quoting issue in your print statement
DECLARE @var1 VARCHAR(50)
SET @var1 = '1'
IF(ISNUMERIC(@var1) = 1)
BEGIN
PRINT 'It is numeric'
END
这篇关于TSQL:检查 varchar 是否可以转换为数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!