SQL Server : error converting data type varchar to numeric

后端 未结 5 1949
谎友^
谎友^ 2020-12-25 12:36

I have a table:

Account_Code | Desc
503100       | account xxx
503103       | account xxx
503104       | account xxx
503102A      | account xxx
503110B               


        
5条回答
  •  生来不讨喜
    2020-12-25 13:12

    I think the problem is not in sub-query but in WHERE clause of outer query. When you use

    WHERE account_code between 503100 and 503105
    

    SQL server will try to convert every value in your Account_code field to integer to test it in provided condition. Obviously it will fail to do so if there will be non-integer characters in some rows.

提交回复
热议问题