在MS SQL中获取字母数字值 [英] Fetching alphanumeric values in ms sql

查看:72
本文介绍了在MS SQL中获取字母数字值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在数据库(ms sql)中有一列是varchar,它接受字母数字值和数字值.
包含类似
的值 10
20
30
A10
A10.5
B11

我想选择介于10和A10.5之间的值,如何实现?

在此先感谢

hi all,

i have a column in database(ms sql) which is varchar ,it accepts alphanumeric values and numeric values.
contains values like
10
20
30
A10
A10.5
B11

i want to select values between 10 and A10.5, how can i achieve it?

thanks in advance

推荐答案

尝试:
SELECT * FROM Test WHERE Id > '10' AND Id <= 'A10.5'


嗨Girish ,
您没有提到表名和列名,所以我将其命名为Table1 ,并将其命名为列name.

关于您的第一个问题:我想选择10到A10.5之间的值,我该如何实现?"

您可以使用此查询:
Hi Girish,
You didn''t mentioned table name and column name so I named it Table1 and named column name.

About your first question : "i want to select values between 10 and A10.5, how can i achieve it?"

You can use this query :
select * from Table1 where name between	'10' and 'A10.5'



关于您的评论:至少如何选择以字母开头的值..."
您可以使用此一个:



And about your comment : "atleast how to select values starting with alphabets..."
You can use this one :

select * from Table1 where name between	'A' and 'Z'



希望对您有所帮助.



Hope it helps.


这篇关于在MS SQL中获取字母数字值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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