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

Troubleshooting Guide: SQL Server Error 2395 — “There is no function ‘%ls:%ls()'”

Why This Error Happens

This error occurs when SQL Server 2025 attempts to resolve a call to a CLR (Common Language Runtime) or extended function that does not exist within the specified assembly or namespace, typically due to a mismatched or corrupted assembly registration. It is commonly triggered after a partial upgrade, a missing assembly reference in sys.assembly_modules, or when a function signature was altered in code but not redeployed to the database. Incompatibility between the .NET runtime version used to compile the assembly and the CLR version hosted by SQL Server 2025 can also cause this lookup to fail.

Step-by-Step Resolution Guide

Step 1: Verify the Assembly and Function Metadata

  • Run SELECT * FROM sys.assembly_modules; to confirm the function and assembly name referenced in the error actually exist.
  • Cross-check the exact namespace and method casing against your source project, since CLR function names are case-sensitive.
  • Confirm the assembly is marked as VISIBLE = ON if it is being called externally.

Step 2: Re-register or Redeploy the CLR Assembly

  • Drop the outdated assembly using DROP ASSEMBLY [YourAssemblyName]; (ensure no dependent functions are active first).
  • Rebuild the DLL in Visual Studio 2022/2025 targeting the correct .NET Framework version supported by SQL Server 2025 (typically .NET Framework 4.8.1 for CLR integration, not .NET Core/5+).
  • Re-import the assembly: CREATE ASSEMBLY [YourAssemblyName] FROM 'C:\SQLAssemblies\YourAssembly.dll' WITH PERMISSION_SET = SAFE;
  • Recreate the function mapping: CREATE FUNCTION dbo.YourFunction (...) RETURNS ... AS EXTERNAL NAME [YourAssemblyName].[Namespace.ClassName].[MethodName];

Step 3: Validate CLR Configuration on the Server

  • Ensure CLR integration is enabled: sp_configure 'clr enabled', 1; RECONFIGURE;
  • On Windows Server 2025/Windows 11, verify that the .NET Framework 4.8.1 feature is installed via Server Manager > Add Roles and Features > .NET Framework 4.8 Features.
  • Restart the SQL Server service (services.msc > SQL Server (MSSQLSERVER) > Restart) to clear any cached assembly metadata.

Step 4: Check for Version Mismatch Across Environments

  • If this function worked in a different environment (Dev/QA), compare the assembly’s file version using Get-Item "C:\SQLAssemblies\YourAssembly.dll" | Select-Object VersionInfo in PowerShell.
  • Redeploy the exact matching DLL version to Production to eliminate drift.

Alternative or Verification Steps

  • To verify the fix, execute the failing query or stored procedure again and confirm no Error 2395 is raised; also query sys.assembly_modules to ensure the function-to-assembly mapping resolves correctly.
  • If the error persists, as a fallback, uninstall and reinstall the CLR assembly entirely using ALTER ASSEMBLY [YourAssemblyName] WITH UNCHECKED DATA to force a full metadata refresh, then redeploy from a clean build.