How to fix Error 4114 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 4114

Why This Error Happens

Error 4114 occurs when a Transact-SQL statement calls a built-in or user-defined function with an incorrect number of arguments. This is typically caused by a syntax mistake in application code, a recent schema change to a user-defined function that altered its parameter signature, or a mismatch between a deployed stored procedure and the function it references after an update or migration. It can also surface after upgrading to SQL Server 2025 if deprecated function signatures were removed or modified in the new engine version.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Query and Function

  • Check the full error message text, which includes the function name and the exact number of arguments required.
  • Use SQL Server Management Studio (SSMS) or Azure Data Studio to locate the query from the application log, SQL Profiler trace, or Extended Events session.
  • Run the following to capture recent failing queries:
  SELECT TOP 50 * FROM sys.dm_exec_query_stats
  CROSS APPLY sys.dm_exec_sql_text(sql_handle)
  WHERE text LIKE '%FunctionName%'

Step 2: Inspect the Function Definition

  • Open the function definition to confirm its expected parameter list.
  • Run the following command, replacing FunctionName with the actual object:
  EXEC sp_helptext 'dbo.FunctionName'
  • Compare the parameter count and data types against how the function is being called in the application or stored procedure.

Step 3: Correct the Function Call or Update the Function

  • If the application code is passing too few or too many arguments, update the calling query to match the function’s signature exactly.
  • If the function itself was altered incorrectly (for example, during a deployment script or migration to SQL Server 2025), use ALTER FUNCTION to restore the correct parameter definition:
  ALTER FUNCTION dbo.FunctionName (@Param1 INT, @Param2 VARCHAR(50))
  RETURNS INT
  AS
  BEGIN
      -- function body
  END
  • Save and redeploy any associated stored procedures or application DLLs that reference this function.

Step 4: Clear Cached Execution Plans

  • After correcting the function or call, clear any stale cached plans that may still reference the old signature.
  • Run the following on the affected database to force recompilation:
  DBCC FREEPROCCACHE
  • Restart the SQL Server service via Services.msc on Windows Server 2025 / Windows 11 if the issue persists after clearing the cache.

Step 5: Validate Application Compatibility

  • Confirm that any client drivers (ODBC, OLE DB, or ADO.NET) connecting to SQL Server 2025 are updated to the latest version, since older drivers may format function calls incorrectly.
  • Check the application’s connection string and ORM mapping (e.g., Entity Framework, Dapper) for auto-generated queries that might be passing incorrect argument counts.

Alternative or Verification Steps

  • Re-run the original failing query or application transaction and confirm Error 4114 no longer appears in the SQL Server Error Log (Management > SQL Server Logs in SSMS).
  • If the error persists, use SQL Server Profiler or Extended Events to trace the exact call stack and confirm whether a cached execution plan or a third-party application layer is still sending the malformed function call.