| Author |
Topic |
|
original_caro
Starting Member
6 Posts |
Posted - 2010-06-30 : 01:28:14
|
| hi all,how could I check if a character column has and character value in it?for example, if a column contains 100, 200, 1AA1, abcd. I want to select value '1AA1' and 'abcd' alone from that column.Regards,carro |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
original_caro
Starting Member
6 Posts |
Posted - 2010-06-30 : 01:44:02
|
| Thank you :)Regards,carro |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
original_caro
Starting Member
6 Posts |
Posted - 2010-06-30 : 02:02:08
|
| Could i do this with out using the function, using like or not like?Regards,carro |
 |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-06-30 : 03:04:21
|
quote: Originally posted by original_caro Could i do this with out using the function, using like or not like?Regards,carro
You need to use:Select... from .. where columnname like '%[a-z]%'I am here to learn from Masters and help new bees in learning. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-06-30 : 05:06:37
|
or this:declare @t table (column_x varchar(25))insert @tselect '1AA1' union allselect '200' union allselect '100' union allselect 'abcd'select * from @twhere not column_x not like '%[^0-9]%' No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
original_caro
Starting Member
6 Posts |
Posted - 2010-06-30 : 07:44:05
|
| Thanks guys.Regards,carro |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-06-30 : 07:51:35
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|