Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2004
    Posts
    5

    Unanswered: Letters space Numbers in the WHERE clause

    Good morning,

    I am stock on a fairly simple WHERE clause query in SQL.
    I would like to select values where my column name is "DA 258", when I did my simple SELECT WHERE statement I receive the following error:
    Msg 245, Level 16, State 1, Line 2
    Conversion failed when converting the nvarchar value 'AH 191' to data type int.

    My code:
    Code:
    USE test
    GO
    DECLARE @find nvarchar(30)
    SET @find = 'DA 258'
    INSERT INTO RadData (KEY, NAME, ID)
    SELECT ID,KEY,NAME
    FROM CALENDAR
    WHERE EVENT_ID = @find
    your help would be greatly appriciated,

    John

  2. #2
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Look at the order of the fields in INSERT vs. SELECT.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  3. #3
    Join Date
    Aug 2004
    Posts
    5
    I feel almost ashamed not to have seen that, thank you so much for your help, it works mighty fine with the right order.
    On hte bright side I got to read a lots of different interesting articles

    Thanks again,

    John

Posting Permissions

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