Results 1 to 5 of 5

Thread: SQL Error

  1. #1
    Toni Guest

    SQL Error

    Can anyone tell me what the following message means and what
    I need to do to correct this problem? When trying to insert
    data into the following table QA_SUB_DATES
    QS_ID INT, PRIMARY KEY, IDENTITY
    QS_REVISION CHAR, 7
    QS_QA_IN_DATE, DATE
    QS_QA_OUT_DATE, DATE
    QS_TYPE_TID, SMALLINT
    (At this time, I don`t have any foreign keys or indexes set on this table.)

    I receive the following error:
    `Msg 260, Level 16, State1
    Disallowed implicit conversion from datatype `varchar`to datatype
    `smallint`
    Use the CONVERT function to run this query.`

    I am trying to insert using the following select statement:
    `Insert into QA_SUB_DATES values ("9A", "01-01-98", "01-02-98", "11")

    Any suggestions? Thanks in advance for your help. I appreciate it!
    Toni




  2. #2
    Jasper Guest

    SQL Error (reply)

    On 10/6/98 7:25:09 AM, Toni wrote:

    The field QS_TYPE_TID will not accept CHAR only SMALLINT data. SQL Server will not convert CHAR to SMALLINT without explicit use of Convert function.

    Try the following

    INSERT INTO QA_SUB_DATES
    VALUES ("9A", "01-01-98", "01-02-98", CONVERT(INT, "11") )

    or

    INSERT INTO QA_SUB_DATES
    VALUES ("9A", "01-01-98", "01-02-98", 11)

    Regards
    Jasper

  3. #3
    VK Guest

    SQL Error (reply)

    Remove quotes from 11(QS_TYPE_TID, SMALLINT). Otherwise it`s recognized as varchar field.
    Do this:

    Insert into QA_SUB_DATES values ("9A", "01-01-98", "01-02-98", 11).

    VK.


  4. #4
    Jasper Guest

    SQL Error (reply)

    On 10/6/98 7:25:09 AM, Toni wrote:

    The field QS_TYPE_TID will not accept CHAR only SMALLINT data. SQL Server will not convert CHAR to SMALLINT without explicit use of Convert function.

    Try the following

    INSERT INTO QA_SUB_DATES
    VALUES ("9A", "01-01-98", "01-02-98", CONVERT(INT, "11") )

    or

    INSERT INTO QA_SUB_DATES
    VALUES ("9A", "01-01-98", "01-02-98", 11)

    Regards
    Jasper

  5. #5
    Toni Guest

    SQL Error (reply)

    Thank you! It worked! I appreciate the replies.

    On 10/6/98 7:25:09 AM, Toni wrote:
    > Can anyone tell me what the following message means and what
    I need to do
    > to correct this problem? When trying to insert
    data into the following
    > table QA_SUB_DATES
    QS_ID INT, PRIMARY KEY,
    > IDENTITY
    QS_REVISION CHAR, 7

    > QS_QA_IN_DATE, DATE

    > QS_QA_OUT_DATE, DATE
    QS_TYPE_TID,
    > SMALLINT
    (At this time, I don`t have any foreign keys or indexes set on
    > this table.)

    I receive the following error:
    `Msg 260, Level 16,
    > State1
    Disallowed implicit conversion from datatype `varchar`to
    > datatype
    `smallint`
    Use the CONVERT function to run this query.`

    I am
    > trying to insert using the following select statement:
    `Insert into
    > QA_SUB_DATES values ("9A", "01-01-98", "01-02-98", "11")

    Any
    > suggestions? Thanks in advance for your help. I appreciate it!
    Toni




Posting Permissions

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