开发者

sql syntax with arithmetic

I am getting a syntax error and I am not sure what I am doing wrong, any help would be much appreciated.

    INSERT INTO mashstp ( mid, name, time, temp, desc )
    VALUES ( '#mid#', '#mashstXML.mash_step.name.xm开发者_开发知识库ltext#',
    '( #mashstXML.mash_step.step_temp.xmltext# * 1.8 ) + 32 F',
    '#mashstXML.mash_step.description.xmltext#')        


You name 5 columns, but only pass 4 values.

mid     '#mid#'
name    '#mashstXML.mash_step.name.xmltext#'
time
temp    '( #mashstXML.mash_step.step_temp.xmltext# * 1.8 ) + 32 F'
desc    '#mashstXML.mash_step.description.xmltext#'

I think it's missing time.


It appears as if you've got your arithmetic inside the string you're inserting. Convert your text to a number and then do the math:

convert(float,'#mashstXML.mash_step.step_temp.xmltext#') * 1.8 + 32.0


You name five columns to receive values but only supply four values.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜