Select Query is not working with WHERE clause when there is a space in column value. since my table column value has space in it. When I copied same value from query result and put that with where clause, it doesn't return any result. .
select * from myTable
if I run below query
select * From myTable where OldLoanNumber ='000000010383904 '
, it doesn't return any result
SQL Server Version is 18.6 as shown in pic
Am I missing anything or any settings related to SQL Query Analyzer?
Use Ltrim, RTrim or Trim like for example
select * From myTable where Trim(OldLoanNumber) =Trim('000000010383904 ')
The ANSI standard says that string comparisons are to be padded to the same length, and I have observed that behavior many times.
I believe the most likely cause of your problem is the last character being a tab or other non space character that simply looks like a space to you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.