Troubleshooting Guide: SQL Server Error 8390 – Deprecated ‘::’ Function Calling Syntax
Why This Error Happens
This error occurs because SQL Server 2025 continues its deprecation path for the legacy ::function_name() calling convention used to invoke system/meta-data functions, which was marked deprecated in earlier versions and is now flagged more aggressively via Error 8390. The root cause is almost always legacy T-SQL code, stored procedures, views, or application-generated queries that still reference built-in functions using the old ::fn_helper() style instead of the fully schema-qualified sys.fn_helper() syntax. This is not a permissions or connectivity issue — it is purely a backward-compatibility warning that signals code will break once the syntax is fully removed in a future SQL Server release.
Step-by-Step Resolution Guide
Step 1: Identify All Instances of the Deprecated Syntax
- Query the SQL Server error log or use Extended Events to capture when Error 8390 fires, since it’s often logged as a warning rather than a hard failure.
- Search your codebase (stored procedures, functions, views, triggers, SSIS packages, and application connection strings) for the pattern
::immediately preceding a function name, e.g.,::fn_sqlvarbasetostr(). - Use a script against
sys.sql_modulesto scan for the literal string'::'combined with common system function names likefn_trace_gettable,fn_virtualfilestats, orfn_sqlvarbasetostr.
Step 2: Replace ‘::’ Syntax with ‘sys.’ Schema-Qualified Calls
- Edit each identified object and change the calling convention from
::function_name(args)tosys.function_name(args). - Example fix: change
SELECT * FROM ::fn_helpcollations()toSELECT * FROM sys.fn_helpcollations(). - Re-deploy or re-compile the modified stored procedures, views, and functions in a test environment first.
Step 3: Update Database Compatibility Level and Validate
- Confirm the database compatibility level under Database Properties > Options > Compatibility Level in SQL Server Management Studio (SSMS), or run
ALTER DATABASE [YourDB] SET COMPATIBILITY_LEVEL = 170;for SQL Server 2025 alignment. - Re-run the previously flagged queries/procedures to confirm Error 8390 no longer appears in the output or logs.
- Check any third-party tools, ORM-generated SQL, or legacy linked-server queries that might still inject the old syntax dynamically.
Step 4: Audit and Patch Application-Level Code
- Review application source code (C#, Java, Python, etc.) for embedded raw SQL strings containing
::function calls. - Update deployment scripts, Entity Framework migrations, or Liquibase/Flyway change sets that may regenerate the deprecated syntax on each release.
- Push corrected code through your CI/CD pipeline and run integration tests against a staging SQL Server 2025 instance.
Alternative or Verification Steps
- Enable SQL Server’s Deprecation Features Extended Event (
sqlserver.deprecation_announcement) and monitor for any residual triggers of Error 8390 over a 24–48 hour production-like workload. - If immediate code remediation isn’t feasible, use
sp_configurewith trace flags only as a temporary stopgap for monitoring, but note that suppressing the warning does not prevent future removal — full syntax migration tosys.is the only permanent fix.