| title | ISNUMERIC (Transact-SQL) | ||||||
|---|---|---|---|---|---|---|---|
| description | ISNUMERIC (Transact-SQL) | ||||||
| author | markingmyname | ||||||
| ms.author | maghan | ||||||
| ms.date | 03/13/2017 | ||||||
| ms.prod | sql | ||||||
| ms.technology | t-sql | ||||||
| ms.topic | reference | ||||||
| f1_keywords |
|
||||||
| helpviewer_keywords |
|
||||||
| dev_langs |
|
||||||
| monikerRange | >= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest || >= sql-server-2016 || >= sql-server-linux-2017 || = azuresqldb-mi-current |
[!INCLUDE sql-asdb-asdbmi-asa-pdw]
Determines whether an expression is a valid numeric type.
Transact-SQL Syntax Conventions
ISNUMERIC ( expression )
[!INCLUDEsql-server-tsql-previous-offline-documentation]
expression
Is the expression to be evaluated.
int
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:
| Area | Numeric data types |
|---|---|
| Exact Numerics | bigint, int, smallint, tinyint, bit |
| Fixed Precision | decimal, numeric |
| Approximate | float, real |
| Monetary Values | money, smallmoney |
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 money and smallmoney (Transact-SQL).
The following example uses ISNUMERIC to return all the postal codes that are not numeric values.
USE AdventureWorks2012;
GO
SELECT City, PostalCode
FROM Person.Address
WHERE ISNUMERIC(PostalCode) <> 1;
GO The following example uses ISNUMERIC to return all the postal codes that are not numeric values.
USE master;
GO
SELECT name, ISNUMERIC(name) AS IsNameANumber, database_id, ISNUMERIC(database_id) AS IsIdANumber
FROM sys.databases;
GO