Microsoft Fabric · Data types
“Conversion failed when converting date and/or time from character string” in a Fabric pipeline
SQL was asked to turn text into a date and met a value it could not read as one. Either the text has day and month in a different order than the conversion expects, or it is not a date at all. Convert with an explicit style and TRY_CONVERT, then deal with the rows that still fail.
Msg 241, Level 16, State 1 Conversion failed when converting date and/or time from character string.
ErrorCode=SqlOperationFailed, ... Message=A database operation failed with the following error: 'Conversion failed when converting date and/or time from character string.' ... SqlErrorNumber=241 ...
What this error means
A statement converts a character column to date or datetime: openly with CAST or CONVERT, or silently by comparing it with a date or inserting it into a date column. SQL Server stops at the first value it cannot convert and raises error 241. In a Copy activity the same message arrives inside SqlOperationFailed.
Unless CONVERT is given a style, the way text is read depends on the session’s language and date format. 24/10/2026 converts to a date under day-month-year settings and fails under month-day-year settings, because there is no month 24.
Why it happens
- The source changed its date format. A file or upstream system that sent
2026-10-24now sends24/10/2026, and the conversion still expects the old form. - Values that are not dates. Placeholders such as
N/Aor0000-00-00, impossible dates such as31/02/2026, or a header row that ended up in the data. - A different session language. The query now runs in another database, with another login or from another tool, whose default language reads day and month the other way round.
- Two formats in one column. Rows from two systems use two formats, so no single setting reads them all.
How to fix it
Find the statement
Open the failed activity. In a Copy activity it is the source query or a pre-copy script. In a Script or Stored procedure activity it is the statement itself.
Find the values that fail
Run this against the source.
TRY_CONVERTreturns NULL where a conversion fails, so the query lists exactly the values that break the statement. Use the style that matches your data.Values that cannot be read as day/month/year 01SELECT order_date02FROM staging.orders03WHERE order_date IS NOT NULL04 AND TRY_CONVERT(date, order_date, 103) IS NULL;
Convert with an explicit style
Style
103reads day/month/year,101reads month/day/year and23readsyyyy-mm-dd. With a style, the result no longer depends on the session’s language.Source query: read day/month/year text explicitly 01 SELECT order_id,02- CAST(order_date AS date) AS order_date,03+ TRY_CONVERT(date, order_date, 103) AS order_date,04 amount05 FROM staging.orders;
Decide what happens to bad values
TRY_CONVERTturns them into NULL. If a missing date is not acceptable, send those rows to a reject table or have them corrected at the source. Do not let them pass unnoticed.Rerun and count
Run the pipeline again and compare the row count with the source, including how many dates came out as NULL.
How to stop it coming back
- Store dates in date columns as early as possible. Dates kept as text are where this error comes from.
- Ask sources for ISO 8601 dates and convert them with style 23, so the result does not depend on language settings.
- Give every text-to-date conversion a style.
With PipelineMender AI
The next failed run explains itself.
PipelineMender reads the failing activity’s error, input and output through the Fabric REST API, and the pipeline definition when it has Contributor access. For this failure the report quotes the conversion in the source query, explains why the value fails under the format in use, and proposes the changed expression for you to review, as in the example on the Microsoft Fabric page.
Is the error in front of you now? Start a trial, choose Report an incident and paste it in. No connection is needed for that.
- Read-only access
- You review every change
- No model training
Questions
Common questions about this error.
Which row caused the conversion error?
SQL Server does not say. Query the source for rows where TRY_CONVERT returns NULL although the text is not NULL. Those are the values that fail.
Why did the same query work before?
Because every value it met until now could be read, or the source used a different format. One new value, or a change in the order of day and month, is enough.
What is the difference between error 241 and error 242?
Error 241 means the text could not be read as a date at all. Error 242 means the conversion produced a value outside the range of the target type, which with datetime columns often also means day and month are swapped.
Checked against: Database Engine errors 0 to 999 (errors 241 and 242) CAST and CONVERT: date and time styles TRY_CONVERT SET DATEFORMAT Troubleshoot the SQL connectors (Microsoft Fabric)
Last reviewed 13 November 2026 against Microsoft’s documentation. PipelineMender AI is an independent product and is not affiliated with Microsoft or Databricks; product names are trademarks of their owners.