[dba-SQLServer] Convert Characters to Number

Francisco Tapia fhtapia at gmail.com
Tue Jul 5 23:44:57 CDT 2005


IsNumeric(LEFT(YourField,2)) = 1

On 7/5/05, David Emerson <newsgrps at dalyn.co.nz> wrote:
> SQL2000.
> 
> I have a varchar field that stores text.  Sometimes the first 2 characters
> will be a number.  I am looking for an easy way to check if the first two
> characters are a valid number, and then convert them to a number so that I
> can do some comparisons with other numbers.
> 
> Regards
> 
> David Emerson
> Dalyn Software Ltd
> 25 Cunliffe St, Churton Park
> Wellington, New Zealand
> Ph/Fax (04) 478-7456
> Mobile 027-280-9348
> 
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
> 
> 


-- 
-Francisco
http://pcthis.blogspot.com |PC news with out the jargon!
http://sqlthis.blogspot.com | Tsql and More...



More information about the dba-SQLServer mailing list