Click here to Skip to main content
15,888,802 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted
Comments
Mehdi Gholam 8-Nov-11 3:01am    
How are you going to compare the values?

Try:
SQL
SELECT * FROM Test WHERE Id > '10' AND Id <= 'A10.5'
 
Share this answer
 
Comments
girish sp 8-Nov-11 3:56am    
atleast how to select values starting with alphabets...
girish sp 8-Nov-11 3:56am    
no this wont work..?
OriginalGriff 8-Nov-11 4:01am    
Did you try it? Because I did...
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 :
SQL
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 :
SQL
select * from Table1 where name between	'A' and 'Z'


Hope it helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900