Covertion error in select query, please help

Discussion in 'Databases' started by HamedAl-Salmi, Mar 14, 2008.

  1. #1
    Hi everybody,

    I get this error :
    MS SQL message: Conversion failed when converting the nvarchar value '2_10' to data type int

    when I try to execute this
    select * from test where code=1111;

    the query work if i use a diffrent column like id (select * from test where id=10;) and it also work if i remove the where clause.

    so i think the problem is in the column "code"

    please help me if you know how to make the query works with out that convertion error
     
    HamedAl-Salmi, Mar 14, 2008 IP
  2. entwickler

    entwickler Member

    Messages:
    74
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #2
    Replace code with
     
    Cheers
    Code (markup):
     
    entwickler, Mar 14, 2008 IP
  3. HamedAl-Salmi

    HamedAl-Salmi Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    entwickler i would like to thank you for your reply

    i get the solution for this problem. it is just a small thing. i just change the query from :
    select * from test where code=1111;
    to:
    select * from test where code='1111';

    thats all. thanks again
     
    HamedAl-Salmi, Mar 14, 2008 IP