Conversion failure

  • I am using Coldfusion to INSERT and SELECT data. I used a to do this:

    When I this, it works. The empty values return [empty string]. But when I run it to INSERT then, I get this:

    Conversion failed when converting the varchar value 'RUN' to data type smallint. The data Type is nvarchar(50). WHen I used integer, I got errors. Thanks in advance for any help.

  • kabaari (8/18/2009)


    I am using Coldfusion to INSERT and SELECT data. I used a to do this:

    When I <cfdump> this, it works. The empty values return [empty string]. But when I run it to INSERT then, I get this:

    Conversion failed when converting the varchar value 'RUN' to data type smallint. The data Type is nvarchar(50). WHen I used integer, I got errors. Thanks in advance for any help.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Lowell,

    INSERT INTO tbl_Assembly_Production(dateProd, Shift, Area, Jig, EmpNo, WorkOrder, Item, ProdTime, CoTime, NpTime, UnitsProd, ProdDelayTime, CoDelayTime, Comment)

    VALUES('#Trim(FORM.dateProd)#',

    '#Trim(FORM.Shift)#',

    '#Trim(FORM.Area)#',

    '#Trim(FORM.jig)#',

    '#Trim(FORM.EmpNo)#',

    '#Trim(FORM.WorkOrder)#',

    '#Trim(FORM.Item)#',

    '#Trim(FORM.ProdTime)#',

    '#Trim(FORM.CoTime)#',

    '#Trim(FORM.NpTime)#',

    '#Trim(FORM.UnitsProd)#',

    '#Trim(FORM.ProdDelayTime)#',

    '#Trim(FORM.CoDelayTime)#',

    '#Trim(FORM.Comment)#')

    SELECT workOrder

    FROM tbl_Assembly_Production

    SELECT WorkOrder

    FROM dbo.tbl_Assembly_Production

    WHERE WorkOrder =

    INSERT INTO tbl_Assembly_Delay

    (Code, DelayTime)

    VALUES('#Trim(FORM.Code)#',

    '#Trim(FORM.DelayTime)#')

  • Lowell,

    I ran your code as is and it did not work. I made the corrections and it still did not work. I changed my code to this:

    Only the first line works partially. I can get a zero but, no calculations.

  • kabaari: It would be helpful if you posted using the code blocks. Then your code and data would be visible on the page.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Produce

    Do Not Produce

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply