开发者

Strange T-SQL if statement behaviour

开发者 https://www.devze.com 2023-01-23 05:52 出处:网络
I have the following T-SQL if statement: if @changeType = \'ChangeFrom\' begin print 开发者_运维问答\'yep\'

I have the following T-SQL if statement:

if @changeType = 'ChangeFrom'
 begin
  print 开发者_运维问答'yep'
 end
else
 begin
  print 'nope'
 end

If @changeType = 'ChangeFrom' I get yep. If @changeType = 'ChangeTo' I get nope. If @changeType ='ChangeFromfsjkfh' I get yep! Whats going on there?


What length have you declared the @ChangeType variable as - it looks like it's getting truncated?

0

精彩评论

暂无评论...
验证码 换一张
取 消