Troubleshooting Guide: SQL Server Error 10743 — Invalid OFFSET Clause Data Type
Why This Error Happens
This error occurs when the value passed to the OFFSET clause in a SELECT ... ORDER BY ... OFFSET ... FETCH NEXT statement is not an integer data type, such as a VARCHAR, DECIMAL, or FLOAT value. SQL Server 2025 strictly enforces that OFFSET and FETCH NEXT arguments must evaluate to BIGINT-compatible integer expressions (typically INT or BIGINT). This commonly happens when application code dynamically builds pagination queries using string concatenation, or when a stored procedure parameter is declared with the wrong data type and passed directly into the OFFSET clause without explicit casting.
Step-by-Step Resolution Guide
Step 1: Identify the Offending Query
- Capture the exact T-SQL statement throwing Error 10743 using SQL Server Profiler, Extended Events, or the application’s query log.
- Check the
OFFSETandFETCH NEXTvalues being passed — look specifically for string literals (e.g.,OFFSET '10' ROWS) or parameters bound asNVARCHAR. - Run the query manually in SQL Server Management Studio (SSMS) to confirm the error reproduces outside the application.
Step 2: Correct the Data Type in the Query or Procedure
- Explicitly cast the offset and fetch values using
CAST(@Offset AS INT)orCAST(@Offset AS BIGINT)directly in theOFFSETclause. - If using a stored procedure, verify the parameter declaration matches an integer type, for example:
CREATE PROCEDURE dbo.GetPagedResults
@PageOffset INT,
@PageSize INT
AS
BEGIN
SELECT * FROM dbo.Orders
ORDER BY OrderID
OFFSET @PageOffset ROWS
FETCH NEXT @PageSize ROWS ONLY;
END
- Avoid passing
NULL, empty strings, or computed expressions that can resolve to non-integer types.
Step 3: Audit Application-Side Parameter Binding
- Inspect the application’s data access layer (e.g., Entity Framework, ADO.NET, or ODBC connection strings) for incorrect parameter type mapping.
- On Windows Server 2025 / Windows 11, check the ODBC Data Source Administrator (
odbcad32.exe) if a DSN is used, and confirm the driver version is SQL Server Native Client 18 or the Microsoft ODBC Driver 18 for SQL Server. - Update any
SqlParameterorSqlDbTypedeclarations in code to useSqlDbType.IntorSqlDbType.BigIntinstead ofSqlDbType.VarCharorSqlDbType.NVarCharfor pagination values.
Step 4: Restart the SQL Server Service and Clear Cached Plans
- Open Services.msc on Windows Server 2025, locate SQL Server (MSSQLSERVER), and restart the service to clear any cached execution plans referencing the faulty query.
- Alternatively, run
DBCC FREEPROCCACHE;in SSMS to flush the plan cache without a full service restart. - Re-run the corrected query to confirm Error 10743 no longer appears.
Alternative or Verification Steps
- Execute the corrected query directly in SSMS with hardcoded integer values (e.g.,
OFFSET 0 ROWS FETCH NEXT 25 ROWS ONLY) to confirm the syntax now parses and returns results without error. - If the error persists after casting, check for implicit conversions in linked server queries or dynamic SQL built via
sp_executesql, and ensure parameters are declared with@Offset INTrather than@Offset NVARCHAR(10)in the parameter definition string.