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 |
hbadministrator
Posting Yak Master
120 Posts |
Posted - 2013-01-17 : 14:25:35
|
I have a field that has data with numbers that can very from 3 chars to 8 chars and some have letters in them. I want to eliminate that data from my selections.example dataField Nameccode10001000f10021004f12321412g21334123h1234512fwhat is my WHERE statementWHERE ccode.... |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2013-01-17 : 16:00:03
|
[code]DECLARE @Foo TABLE (Col VARCHAR(10))INSERT @FooVALUES('ccode'),('1000'),('1000f'),('1002'),('1004f'),('12321412g'),('21334123h'),('1234512f')-- NO values with a-zSELECT *FROM @FooWHERE Col NOT LIKE '%[a-z]%'--OR, olny values that are 0-9SELECT *FROM @FooWHERE Col NOT LIKE '%[^0-9]%'[/code] |
|
|
|
|
|