从SQL Server 2008选择数据时出现问题 [英] Issue in selecting data from SQL Server 2008

查看:116
本文介绍了从SQL Server 2008选择数据时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我的SQL Server中有一张表.我已经将所有数据从Excel复制到表中.当我这样查询数据时.

Hi,
I have a table in my SQL Server. I have copied all the data from an excel to table. When I am querying the data like this..

SELECT [App_Name],[Link],[Comments] FROM [App_Links] where Env_Ref_ID=1 
and App_Name = 'O2'



我没有得到结果.但是当查询为
时,我的表中有O2



I am not getting the result. But I have O2 in my table when queries as

SELECT [App_Name],[Link],[Comments] FROM [App_Links] where Env_Ref_ID=1 


问题是App_Name列似乎有一些空格或其他特殊字符.我什至尝试过..


Issue is Column App_Name has got some space or other special characters it seems. I even tried with this..

SELECT [App_Name],[Link],[Comments] FROM [App_Links] where Env_Ref_ID=1 
and LTRIM(RTRIM( App_Name)) = 'O2'  order by Link


但没有用.当我尝试复制单元格数据时,就像这样的"O2".
任何建议儿子请.
谢谢
Sreenath


but was no use. When I tried to copy cell data it was like this ''O2 ''.
Any suggestion son this please.
Thanks
Sreenath

推荐答案

更新表,替换/删除所有不需要的字符.
Update your table with all unwanted characters replaced/removed.


您似乎正在查询"02" ",但数据为"O2".换句话说,您正在寻找零二,但它包含字母O加两个.
It looks like you are querying on ''02'' but the data is ''O2''. In other words you are looking for zero-two but it contains the letter O plus the two.


数据清理将是改善可维护性指数的最佳选择.否则,请尝试使用LIKE 关键字而不是=
Data clean up will the best option to improve your maintainability index. else please try by using LIKE keyword instead of =


这篇关于从SQL Server 2008选择数据时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆