You are here: Re: Searching/Estracting numerical data « MsSQL Server « IT news, forums, messages
Re: Searching/Estracting numerical data

Posted by Erland Sommarskog on 02/07/06 00:24

KR (kraman@bastyr.edu) writes:
> I am new to the SQL world, and I am trying to come up with a script
> that will extract only the numerical data from a column of varchar
> data type . There is not a pattern to the data entered, except that
> the data that
> I am looking to extract is a three digit number. If someone could
> point me in the right direction that would be great.

SELECT cast(col as int) FROM tbl WHERE col LIKE '[0-9][0-9][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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация