|  | Posted by jaawaad on 06/20/93 11:52 
I think this works for me...i tried this with success so far...
 select * from Table where substring(COL2,2,6) Like '%[0-9]')
 
 As i know a char [A-Z] will only appear at position 7 of the string. It
 only returns values that are ending with a digit.
 
 
 Erland Sommarskog wrote:
 > (jaawaad@gmail.com) writes:
 > > I have a text field in a table that contains number along with chars.
 > > Is there a way i can write a query to show all the fields that contains
 > > just Numbers or Char in a field??
 > >
 > > TBALE Example
 > >
 > > COL1    :    COL2(nvarchar)
 > > ---------------------------
 > > 100             345G01
 > > 200             123456789
 > > 300              GQ9220
 >
 > Not really sure what you are looking for, but this query returns all
 > rows with digits only in COL2.
 >
 >    SELECT col2
 >    FROM   tbl
 >    WHERE  col2 NOT LIKE '%[^0-9]%'
 >
 >
 > --
 > Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
 >
 > Books Online for SQL Server 2005 at
 > http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
 > Books Online for SQL Server 2000 at
 > http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
  Navigation: [Reply to this message] |