SQLUSA

Microsoft SQL Server 2008 Best Practices

How to use the SQL isnumeric function?

 

Execute the following script in Query Editor to demonstrate the application of the isnumeric() function to check for non-numeric zip (postal) codes like the ones used in Canada and United Kingdom:

USE AdventureWorks2008;

GO

SELECT DISTINCT

City,

StateProvinceCode,

Country = cr.Name,

PostalCode

FROM Person.Address a

INNER JOIN Person.StateProvince sp

ON a.StateProvinceID = sp.StateProvinceID

JOIN Person.CountryRegion cr

on cr.CountryRegionCode = sp.CountryRegionCode

WHERE ISNUMERIC(PostalCode)<> 1

ORDER BY Country, StateProvinceCode, City;

GO

 

 

 

SQLUSA - The Best SQL Server 2008 Training in the World
 
 
SQLUSA.com Home Page