5

In SQL Server, I am trying to select some of the records using a string which has space so I trim and use but something is wrong please correct me where something is missed by me.

SELECT * FROM projects where str_id=ltrim(rtrim('   artf130 ')) --- No rows selected
SELECT * FROM projects where str_id='artf130' -- one row selected

Update: I copied the first line from google spread sheet.

4
  • 4
    Hello! Maybe take a look in here: stackoverflow.com/questions/14211346/… And maybe give the answer a vote up. Commented Feb 9, 2017 at 13:13
  • @Cataklysim thanks and given. Commented Feb 9, 2017 at 13:18
  • @sunleo "so I trim and use but something is wrong please correct me" what is that 'something'? show us some sample data. Commented Feb 9, 2017 at 13:30
  • When I copied from google spread sheet some in-visible characters are there and, ltrim and rtrim could not remove them. Commented Feb 9, 2017 at 13:42

1 Answer 1

2

Maybe that was my bad. People keep helping. I think my comment was enough, cause I linked to a very similar problem, which got a answer. So here for everyone:

You can see the answer to that question here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.