Sdílet prostřednictvím


ISNUMERIC (Transact-SQL)

Determines whether an expression is a valid numeric type.

Topic link iconTransact-SQL Syntax Conventions

Syntax

ISNUMERIC (expression )

Arguments

Return Types

int

Remarks

ISNUMERIC returns 1 when the input expression evaluates to a valid numeric data type; otherwise it returns 0. Valid numeric data types include the following:

int

numeric

bigint

money

smallint

smallmoney

tinyint

float

decimal

real

Note

ISNUMERIC returns 1 for some characters that are not numbers, such as plus (+), minus (-), and valid currency symbols such as the dollar sign ($). For a complete list of currency symbols, see Using Monetary Data.

Examples

The following example uses ISNUMERIC to return all the postal codes that are not numeric values.

USE AdventureWorks;
GO
SELECT City, PostalCode
FROM Person.Address 
WHERE ISNUMERIC(PostalCode)<> 1;
GO