[dba-SQLServer] Convert Characters to Number

Paul Hartland Paul.Hartland at orridge.co.uk
Wed Jul 6 02:31:02 CDT 2005


How about :

	ISNUMERIC(LEFT(FieldName,2)) 


PAUL HARTLAND
Database Designer/Programmer
paul.hartland at isharp.co.uk
ISHARP
DDI - 01922 472031
Mobile - 07730 523179

 

ISHARP (Information Services for Hospitality, Audit, Retail and
Pharmacy) provide IT resources for the Christie Group Stock & Inventory
Services companies.


-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David
Emerson
Sent: 06 July 2005 05:00
To: dba-SQLServer at databaseadvisors.com
Subject: [dba-SQLServer] Convert Characters to Number

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


_______________________________________________

*  This message is confidential.
*  This email, its content and any files transmitted with it are intended solely for the addressee and may be legally privileged and/or confidential.
*  Access by any other party is unauthorised without the express written permission of the sender.
*  If you have received this email in error you may not copy or use the contents, attachments or information in any way and any review, use, dissemination, forwarding, disclosure, alteration, printing of this information is strictly prohibited. Please destroy it and notify the sender via return e-mail.
*  This email has been prepared using information believed by Paul Hartland to be reliable and accurate, but the company makes no warranty as to accuracy or completeness. In particular the author does not accept responsibility for changes made to this email after it was sent.
*  Any opinions expressed in this document are those of the author and do not necessarily reflect the opinions of the company or its affiliates.

The Orridge web site can be found at:
http://www.orridge.co.uk





More information about the dba-SQLServer mailing list