开发者

sql syntax with arithmetic

开发者 https://www.devze.com 2023-02-08 17:29 出处:网络
I am getting a syntax error and I am not sure what I am doing wrong, any help would be much appreciated.

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

精彩评论

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