空格比较时 空字符串跟任意长度的半角空格字符串比较,结果都为TRUE
DECLARE @TRUSTOR VARCHAR(5) SET @TRUSTOR = ‘‘ IF @TRUSTOR IS NULL BEGIN SELECT ‘IS NULL‘ END IF @TRUSTOR = SPACE(5) BEGIN SELECT ‘‘‘‘‘ = SPACE5‘ END -- 执行结果:‘‘ = SPA
2024-01-09 09:23:52
空格比较时 空字符串跟任意长度的半角空格字符串比较,结果都为TRUE
DECLARE @TRUSTOR VARCHAR(5) SET @TRUSTOR = ‘‘ IF @TRUSTOR IS NULL BEGIN SELECT ‘IS NULL‘ END IF @TRUSTOR = SPACE(5) BEGIN SELECT ‘‘‘‘‘ = SPACE5‘ END -- 执行结果:‘‘ = SPA