我收到此错误,但无法找出原因。
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') +')'
+
我只想添加另一个案例
答案 0 :(得分:1)
您的查询中还有2个+
,THEN
部分末尾有1个,ELSE
部分末尾有另一个CASE
。如果您需要将+
表达式与其他字符串合并,请在END
之后使用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
+ 'Any string after CASE expression'
。请尝试以下方法:
document.querySelector('.selectable-icons').addEventListener('click', function(e) {
document.querySelector('[contenteditable]').appendChild(e.target.cloneNode(true));
});
document.querySelector('div').addEventListener('keydown', function(event) {
// Check for a backspace
if (event.which == 8) {
s = window.getSelection();
r = s.getRangeAt(0)
el = r.startContainer.parentElement
// Check if the current element is the .label
if (el.classList.contains('label')) {
// Check if we are exactly at the end of the .label element
if (r.startOffset == r.endOffset && r.endOffset == el.textContent.length) {
// prevent the default delete behavior
event.preventDefault();
if (el.classList.contains('highlight')) {
// remove the element
el.remove();
} else {
el.classList.add('highlight');
}
return;
}
}
}
event.target.querySelectorAll('span.label.highlight').forEach(function(el) { el.classList.remove('highlight');})
});