我收到此错误,我找不到原因。sql server 2012:关键字'else'附近的语法不正确
case when FormFields.fieldtype like '%date%'
then 'not' + fieldname + ' is null and (convert(datetime,'
+ fieldname +',103) < '
+ coalesce(str(FormFields.MinDate),'1/1/1900') + ')'
+ ' or (convert(datetime,' + fieldname +',103) > '
+ coalesce(str(FormFields.MaxDate), '1/1/2200') + ')'
+
else
'not '+ fieldname + ' is null and (convert(float,'+ fieldname+') <'
+ coalesce(str(FormFields.MinValue),'-99999999')
+ ' or convert(float,'+ fieldname+') >'
+ coalesce(str(FormFields.MaxValue),'99999999') +')'
+
end
前面的代码没有任何错误:
'not '+ fieldname + ' is null and (convert(float,'+ fieldname+') <'
+ coalesce(str(FormFields.MinValue),'-99999999')
+ ' or convert(float,'+ fieldname+') >'
+ coalesce(str(FormFields.MaxValue),'99999999') +')'
+
我只是想补充另一种情况
也许在'then'行结尾的超级+符号? –
结尾 –
还有另外一个建筑字符串代码的一部分,这就是为什么有额外的'+' – aggicd