從字符串中刪除空格並在sql server中使用該字符串進行選擇

[英]Remove spaces from string and select using that string in sql server


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.

在SQL Server中,我試圖使用一個有空格的字符串選擇一些記錄,所以我修剪和使用但是有些錯誤請糾正我,我錯過了哪些內容。

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.

更新:我從谷歌電子表格復制了第一行。

1 个解决方案

#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.

你可以在這里看到這個問題的答案。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2017/02/09/720a1aa007d780290453fc607bf61d53.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com