Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
icw
Constraint Violating Yak Guru
378 Posts |
Posted - 2007-01-17 : 01:07:20
|
| Hi I have a postcode field that is varchar. I know that some of the postcodes have been entered incorrectly (they do not have a number in them)I want to run a query that will show me the records that do not have a number anywhere in the field.I can't think how to go about this, any help would be really appreciated.ICW |
|
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2007-01-17 : 01:35:25
|
| here's one wayselect * from table1 awhere not (a.field like '%1%') andnot (a.field like '%2%') andnot (a.field like '%3%') andnot (a.field like '%4%') andnot (a.field like '%5%') andnot (a.field like '%6%') andnot (a.field like '%7%') andnot (a.field like '%8%') andnot (a.field like '%9%') andnot (a.field like '%0%') |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-17 : 02:38:58
|
| This can be considered tooSELECT * FROM <YourTableNameHere> WHERE <YourColumnNameHere> NOT LIKE '%[0-9]%'Peter LarssonHelsingborg, Sweden |
 |
|
|
icw
Constraint Violating Yak Guru
378 Posts |
Posted - 2007-01-17 : 03:11:33
|
| thanks a lot guys |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-17 : 03:17:30
|
| Are you talking about english post codes?If so, is there a way to check complete structure of post code?Post code 4NG E34:First digit is always numeric. Second and third digit are always alpha.Fourth digit is alpha. Fifth and sixth are always numeric.Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|