views:

30

answers:

1

I want to select records if a particular column has numbers in its name.

Table 1

ID   EmpCode    EmpName
1    1C         Name1
2    2C         Name2
3    C3         Name3
4    CD         Name4
5    CD         Name4
6    C6D        Name6
7    7CD        Name7

I need to select records 1,2,3,6,7 based on EmpCode. How can this be performed?

EDIT: EmpCode can have number in any position

+3  A: 
SELECT * FROM table WHERE EmpCode REGEX '[0-9]'

Or alternatively, if you want to check for 'starts with a digit' instead of 'contains a digit':

SELECT * FROM table WHERE EmpCode REGEX '^[0-9]'
tdammers
I did used this query but blindly checked for different column S**t!!! :)
Sri Kumar