Skip to content

Latest commit

 

History

History
100 lines (75 loc) · 3.27 KB

File metadata and controls

100 lines (75 loc) · 3.27 KB
title ISNUMERIC (Transact-SQL)
description ISNUMERIC determines whether an expression is a valid numeric type.
author markingmyname
ms.author maghan
ms.reviewer randolphwest
ms.date 02/05/2024
ms.service sql
ms.subservice t-sql
ms.topic reference
ms.custom
ignite-2025
f1_keywords
ISNUMERIC
ISNUMERIC_TSQL
helpviewer_keywords
expressions [SQL Server], valid numeric type
numeric data
ISNUMERIC function
verifying valid numeric type
valid numeric type [SQL Server]
checking valid numeric type
dev_langs
TSQL
monikerRange >=aps-pdw-2016 || =azuresqldb-current || =azure-sqldw-latest || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric || =fabric-sqldb

ISNUMERIC (Transact-SQL)

[!INCLUDE sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw-fabricsqldb]

Determines whether an expression is a valid numeric type.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

ISNUMERIC ( expression )

Arguments

expression

The expression to be evaluated.

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 items:

Area Numeric data types
Exact numerics bigint, int, smallint, tinyint, bit
Fixed precision decimal, numeric
Approximate float, real
Monetary values money, smallmoney

ISNUMERIC returns 1 for some characters that aren't 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).

Examples

The following example uses ISNUMERIC to return all the postal codes that aren't numeric values.

USE AdventureWorks2022;
GO

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

Examples: [!INCLUDE ssazuresynapse-md] and [!INCLUDE ssPDW]

The following example uses ISNUMERIC to return whether the database name and ID are numeric values.

USE master;
GO

SELECT name,
    ISNUMERIC(name) AS IsNameANumber,
    database_id,
    ISNUMERIC(database_id) AS IsIdANumber
FROM sys.databases;
GO

Related content