Handling Invalid Numeric Inputs in Snowflake
Snowflake raises Numeric value '…' is not recognized when an expression, target column, or load operation expects a number but receives text it cannot parse, such as a blank space, 'null', 'ARGA', a CSV header, or a formatted value like '1,646.00'. Find where Snowflake converts the value, inspect the original string, normalize only formats your data contract permits, and then either reject bad values or convert them safely to SQL NULL.
Use this table to match the message to the most likely cause.
| Symptom | Likely Cause | Fix |
|---|---|---|
Numeric value ' ' is not recognized |
A space-only string reached a numeric cast or arithmetic expression. | Trim the value and turn empty strings into SQL NULL. |
Numeric value 'null' is not recognized |
The source contains the literal text 'null', not the SQL value NULL. |
Convert approved text placeholders to SQL NULL before casting. |
Numeric value 'unknown' or Numeric value 'ARGA' |
A nonnumeric business value is stored in a field being treated as numeric. | Correct the source mapping, or classify that value as missing/rejected data. |
Numeric value '1,646.00' is not recognized |
The number has a thousands separator or other display formatting. | Validate the expected format, then remove grouping commas before conversion. |
| The error names a CSV file and line 1 | Snowflake is trying to load a header such as Index into a numeric column. |
Configure header handling or remove the header from the incoming file. |
| A column name beginning with a number fails | The identifier needs double quotes, or should be renamed. | Reference it as "2024_sales" or rename it to an unquoted-safe name. |
What the Snowflake Error Means
Snowflake stores numbers and text as different data types. The error appears when it must convert a character value into a numeric type such as NUMBER, DECIMAL, INTEGER, or FLOAT, but the characters do not form a valid number.
The conversion can be explicit:
SELECT TO_NUMBER(raw_amount)
FROM landing_orders;
It can also be implicit. Arithmetic operators require numeric input, so this can fail even when you did not write a cast:
SELECT raw_amount_a - raw_amount_b
FROM landing_orders;
A load can cause the same problem when a staged CSV field is inserted into a numeric target column.
The text inside the error is the important clue. Numeric value 'ARGA' is not recognized means Snowflake encountered the letters ARGA where it expected numeric characters. Numeric value 'null' is not recognized means it received four text characters, n, u, l, l, not a database null.
This is a parsing problem, not a numeric precision problem. A valid numeric value and text that cannot be parsed are different problems.
How to Fix Snowflake Numeric Value Errors
Fix numeric value errors by identifying failed values, classifying them, normalizing approved formats, and choosing strict or tolerant conversion.
Step 1: Find the Exact Values That Fail Conversion
Start with the raw source field rather than the calculation or insert that failed. Use TRY_TO_NUMBER to identify values that cannot be parsed without stopping the query.
- Replace
landing_ordersandraw_amountwith your source table and column. - Run the diagnostic query.
- Review every returned value before deciding whether it is missing data, invalid data, or a supported format that needs cleaning.
SELECT
raw_amount,
TRY_TO_NUMBER(NULLIF(TRIM(raw_amount), '')) AS candidate_number
FROM landing_orders
WHERE raw_amount IS NOT NULL
AND NULLIF(TRIM(raw_amount), '') IS NOT NULL
AND TRY_TO_NUMBER(NULLIF(TRIM(raw_amount), '')) IS NULL;
This query excludes actual nulls and empty values after trimming surrounding spaces. It returns values such as null, unknown, Index, ARGA, currency symbols, commas, and malformed numeric text.
I use a database client to run this diagnostic query before changing a load, because it shows the raw value and attempted numeric result side by side.
Step 2: Decide What Each Nonnumeric Value Means
Do not automatically turn every invalid value into zero. Zero is a real numeric measurement or amount; it is not a safe substitute for “not supplied,” “unknown,” or “could not parse.”
Classify the values you found:
- Treat blanks, a text null marker, or an approved missing-data marker as SQL
NULL. - Correct values that should never have appeared in the numeric field, such as product labels or codes.
- Reject malformed values rather than silently changing their meaning.
- Preserve the original text in a landing or audit column when the data matters for reconciliation.
For example, a source may define '', 'null', 'unknown', and 'n/a' as missing. That is a business rule, not a universal Snowflake rule. Only include tokens your source system actually uses.
Step 3: Normalize Approved Missing Values and Number Formatting
Create a cleaned expression that keeps valid number strings, converts approved placeholders to SQL NULL, and removes formatting you explicitly support.
WITH cleaned AS (
SELECT
raw_amount AS raw_value,
CASE
WHEN raw_amount IS NULL THEN NULL
WHEN LOWER(TRIM(raw_amount)) IN ('', 'null', 'unknown', 'n/a') THEN NULL
ELSE REPLACE(TRIM(raw_amount), ',', '')
END AS normalized_value
FROM landing_orders
)
SELECT
raw_value,
normalized_value,
TRY_TO_NUMBER(normalized_value) AS parsed_amount
FROM cleaned;
This handles common cases:
- A value containing only spaces becomes
NULL. - The string
'null'becomesNULL. - The display-formatted text
'1,646.00'becomes1646.00. - A bad value such as
'ARGA'remains nonnumeric and producesNULLthroughTRY_TO_NUMBER.
Only remove commas if the input contract defines them as thousands separators. Blindly removing punctuation can corrupt data from a source that uses a different numeric convention or contains malformed grouping.
Step 4: Choose Strict Conversion or Tolerant Conversion
Use strict conversion when invalid input must stop the pipeline. Use tolerant conversion when you need to load valid records while separately reviewing invalid ones.
For a strict validation or final transformation, use TO_NUMBER. It raises an error when it sees unacceptable input:
SELECT TO_NUMBER(normalized_value) AS amount
FROM cleaned_source;
For a tolerant staging transformation, use TRY_TO_NUMBER. It returns SQL NULL instead of aborting the query:
SELECT TRY_TO_NUMBER(normalized_value) AS amount
FROM cleaned_source;
TRY_TO_NUMBER prevents a query failure, but it does not make bad data disappear safely. Keep a rejection query or an audit table for rows where a nonblank normalized value produces NULL.
SELECT
raw_value,
normalized_value
FROM cleaned_source
WHERE normalized_value IS NOT NULL
AND TRY_TO_NUMBER(normalized_value) IS NULL;
Step 5: Rebuild the Calculation Using Numeric Expressions
After cleaning the inputs, perform arithmetic with parsed numeric columns or expressions, not the raw strings.
WITH parsed AS (
SELECT
TRY_TO_NUMBER(NULLIF(TRIM(raw_amount_a), '')) AS amount_a,
TRY_TO_NUMBER(NULLIF(TRIM(raw_amount_b), '')) AS amount_b
FROM landing_orders
)
SELECT
amount_a - amount_b AS amount_difference
FROM parsed;
If either side is missing, the result is NULL. Do not add COALESCE(..., 0) unless a missing amount truly means zero in your business logic.
Finish by running the rejection query and resolving or documenting every returned value. Once it returns no unexpected values, apply the same cleaning logic in the view, transformation, or load that originally failed.
Handling Blank, Null, Unknown, and Text Values
SQL NULL and the string 'null' are different values.
SELECT
NULL AS sql_null,
'null' AS text_null;
The first value is absent. The second is text and cannot be parsed as a number. The same distinction applies to 'unknown', 'N/A', '-', and a single space.
A blank-looking value may be an empty string or a string containing surrounding spaces. NULLIF(TRIM(raw_amount), '') is useful because it converts both '' and ' ' into SQL NULL.
ARGA is not a Snowflake keyword or a special numeric marker. If Snowflake says Numeric value 'ARGA' is not recognized, the letters are present in the data flowing into a numeric conversion. Check the source column, CSV field order, join condition, CASE expression, and insert mapping for a text field being sent to a numeric destination.
Parsing Values Such as 1,646.00 Safely
A value such as '1,646.00' is readable to people but is not necessarily in the plain numeric form expected by a cast. Removing commas can be appropriate when the source consistently uses commas for thousands grouping.
For feeds where strict formatting matters, validate the string before removing commas. This example accepts optional signs, correctly grouped commas, and an optional decimal portion.
SELECT
raw_amount,
CASE
WHEN REGEXP_LIKE(
TRIM(raw_amount),
'^[+-]?([0-9]{1,3}(,[0-9]{3})+|[0-9]+)([.][0-9]+)?$'
)
THEN TRY_TO_NUMBER(REPLACE(TRIM(raw_amount), ',', ''))
END AS parsed_amount
FROM landing_orders;
This avoids treating a malformed value such as '1,6,46' as a valid number after punctuation removal.
If values also contain currency symbols, percent signs, accounting parentheses, or locale-specific decimals, define and test those rules separately. A broad cleanup expression that strips arbitrary characters can turn invalid financial data into plausible but incorrect numbers.
Fixing Snowflake Column Names That Start With Numbers
A column name beginning with a number is an identifier issue, not a numeric-data issue. Snowflake unquoted identifiers must begin with a letter or underscore. A name such as 2024_sales must be delimited with double quotes when it is created and referenced.
CREATE TABLE sales (
"2024_sales" NUMBER
);
Use the exact quoted name in queries:
SELECT "2024_sales"
FROM sales;
Double quotes identify an object name; single quotes create a string value. These are different:
SELECT "2024_sales" AS numeric_column,
'2024_sales' AS text_value
FROM sales;
Quoted identifiers preserve case and require exact spelling. For a new schema, a simpler long-term choice is an unquoted-safe name such as sales_2024 or sales_for_2024.
ALTER TABLE sales
RENAME COLUMN "2024_sales" TO sales_2024;
Renaming removes the need to remember double quotes in every query, view, procedure, and transformation.
Diagnosing Numeric Errors During COPY INTO
When the error includes a staged filename, line number, character position, and target column, the failure happened during file loading rather than a later query.
A message such as Numeric value 'Index' is not recognized on the first line often means a CSV header was loaded as though it were a data row. Other common file-load causes include:
- The source fields are in a different order from the target columns.
- A delimiter or quote setting does not match the incoming file.
- An extra delimiter shifts text into a numeric field.
- A source system exports textual placeholders such as
nullorunknown. - The target column is numeric but the file field is an identifier or label.
Validate the load before inserting rows into the target table.
COPY INTO target_table
FROM @my_stage/incoming/
FILE_FORMAT = (FORMAT_NAME = my_csv_format)
VALIDATION_MODE = 'RETURN_ERRORS';
Inspect the returned errors, then correct the file format’s delimiter, quote, and header behavior or correct the producer’s file. When validation is clean, run the load without validation mode.
COPY INTO target_table
FROM @my_stage/incoming/
FILE_FORMAT = (FORMAT_NAME = my_csv_format);
Avoid using error-continuation settings as the primary fix. They can let a load finish while silently excluding records you still need to reconcile.
Confirming the Fix and Preventing a Repeat
Before treating the problem as resolved, confirm all of the following:
- The source field is being treated as text until its cleanup rules are applied.
- Approved missing markers become SQL
NULL, not zero. - Valid formatted numbers are converted according to a documented input format.
- Invalid nonblank values are returned by a rejection query or routed to an audit process.
- Arithmetic uses parsed numeric expressions rather than raw text fields.
- CSV headers and column order match the load configuration.
- Numeric-looking column names are double-quoted or renamed to safe identifiers.
The most durable design is to land external data as text, validate it, retain the original value for auditability, and insert only validated numeric values into curated numeric columns.
Frequently Asked Questions
Why Does Snowflake Say Numeric Value ‘null’ Is Not Recognized?
The quoted value is the literal text string ‘null’ , so a numeric conversion cannot treat it as the SQL NULL value. Convert approved text placeholders with an expression such as NULLIF or CASE, then apply TRY_TO_NUMBER or TO_NUMBER. Do not use COALESCE(..., 0) unless the source definition says a missing value represents zero.
Why Does Subtracting Two Values Produce Numeric Value ” Is Not Recognized?
The subtraction operator requires numbers, and one of the source values is an empty string. Convert empty or space-only strings with NULLIF(TRIM(column_name), ''), then parse the remaining text with TRY_TO_NUMBER or strict TO_NUMBER. A missing input produces a NULL result unless you apply a documented missing-value rule.
How Do I Convert 1,646.00 to a Snowflake Number?
Validate that commas are thousands separators in the source, remove them, and parse the remaining value. TRY_TO_NUMBER(REPLACE(TRIM(raw_amount), ',', '')) converts a valid value such as '1,646.00' to a number while returning NULL for invalid text. Use a regular-expression check first when malformed comma placement is possible.
Can a Snowflake Column Name Start With a Number?
Yes, but it must be a quoted identifier, such as "2024_sales". You must use the same double-quoted spelling whenever you reference it, because "2024_sales" is a column name while '2024_sales' is text. Renaming it to sales_2024 is usually easier for long-term maintenance.
What Does Numeric Value ‘ARGA’ Is Not Recognized Mean?
The literal text ARGA reached a numeric conversion, so Snowflake rejected it because it does not form a number. Snowflake does not treat ARGA as a special null, unknown, or numeric value. Inspect the source field mapping and decide whether ARGA is invalid input, a missing-data marker your pipeline should explicitly handle, or evidence that the wrong source column is being loaded.
