哪个SQL查询将从数字开始检索值 [英] Which SQL Query is to retrieve the values starting from a digit

查看:97
本文介绍了哪个SQL查询将从数字开始检索值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从tbl_emps中检索所有从数字开始的值.有人可以告诉我有关此短句的SQL查询吗?

I want to retrieve all the values from tbl_emps which starts from a digit. Can Some One tell me the SQL Query for this puprose?

推荐答案

SELECT * FROM table_name WHERE column_name LIKE '[0123456789]%';





当然可以了

欢呼.





Sure, it will work

cheers.


尝试一下:
Try this:
SELECT * FROM myTable WHERE myField LIKE '[0123456789]%'

[0123456789]部分显示此集合中的任何字符",%完全匹配任何文本.

The [0123456789] part says "any character in this set" and the % matches any text at all.


另一种变化是
And another variation is
SELECT ...
FROM   YourTable 
WHERE  1 = ISNUMERIC( SUBSTRING( FieldName, 1, 1))


但是,如果您需要在查询中找到此类信息,则可能表明您实际上是在单个字段内串联两个单独的数据项.因此,如果是这种情况,那么我建议您将每个数据存储在它自己的字段中.


However, If you need to find this kind of information in your query it may indicate that you are actually concatenating two separate data items inside a single field. So if that would be the case, then I''d suggest that you store each data in it''s own field.


这篇关于哪个SQL查询将从数字开始检索值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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