|
Posted by Erland Sommarskog on 10/10/66 11:52
(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]
|