Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2011
    Posts
    3

    Unanswered: Date Conversion Issue

    Hello programmers. I was running a SP for the past couple of years. I dropped it to create it again with an additional column included (cmpcode). Now I get the below error message. Can someone help me with resolving this? Thank you. See attached.

    CODE:
    CREATE PROC BLTextData

    @pay_date DATETIME

    AS

    DELETE zoas_apcheckinfo

    INSERT zoas_apcheckinfo
    SELECT cmpcode,
    invno,
    vendor,
    paydate,
    doccode,
    checkno,
    invamt,
    checkamt,
    status,
    duedate,
    year,
    period,
    docdate,
    vendorname,
    docnum

    FROM oas_apcheckinfo
    WHERE paydate = @pay_date
    ORDER BY vendor

    ERROR:
    Msg 257, Level 16, State 3, Procedure BLTextData, Line 11
    Implicit conversion from data type datetime to smallint is not allowed. Use the CONVERT function to run this query.
    Attached Files Attached Files

  2. #2
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    So the error says that you are trying to push a datetime value into a smallint field.

    Is it possible that you are accidentally doing that???
    Ken

    Maverick Software Design

    (847) 864-3600 x2

  3. #3
    Join Date
    Nov 2011
    Posts
    3
    Ok, thanks for the reply. I figured it out. I had one of my columns out of order.

  4. #4
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    You just found out why it is better to write INSERT scrpits like this:
    Code:
    INSERT zoas_apcheckinfo (cmpcode, invno, vendor,
       paydate, doccode, checkno,
       invamt, checkamt, status,
       duedate, year, period,
       docdate, vendorname, docnum)
    SELECT cmpcode, invno, vendor,
       paydate, doccode, checkno,
       invamt, checkamt, status,
       duedate, year, period,
       docdate, vendorname, docnum
    FROM oas_apcheckinfo
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •