Troubleshooting Guide: SQL Server Error 11712
Why This Error Happens
Error 11712 (“Argument ‘%.*ls’ can not be specified more than once”) occurs when a T-SQL statement, stored procedure call, or command-line utility (such as sqlcmd, bcp, or DBCC commands) receives the same named argument or parameter passed in twice within a single statement. This is typically caused by duplicate parameter entries in dynamically generated SQL, a scripting error in an ORM or ETL tool, or a malformed connection string/startup parameter in SQL Server 2025 configuration. It can also surface after an in-place upgrade to Windows Server 2025 if legacy automation scripts pass both positional and named versions of the same argument.
Step-by-Step Resolution Guide
Step 1: Identify the Offending Statement or Command
- Capture the exact query or command from SQL Server Error Log at
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG. - Enable SQL Server Profiler or Extended Events (
sys.fn_xe_file_target_read_file) to trace the exact batch text that triggered Error 11712. - Check Windows Event Viewer under Applications and Services Logs > Microsoft > Windows > SQL Server for correlated Event ID 11712 entries.
Step 2: Inspect and Correct Duplicate Parameters
- Review the T-SQL syntax for repeated
@ParameterNameusage inEXECorsp_executesqlcalls. - For command-line tools, check for duplicated flags, e.g., running
sqlcmd -S localhost -d MyDB -d MyDB(the-dflag specified twice). - If using an ORM (Entity Framework, Dapper, etc.), inspect the generated SQL for duplicate parameter binding caused by misconfigured mapping classes.
Step 3: Validate Startup Parameters and Configuration Manager Settings
- Open SQL Server Configuration Manager on Windows Server 2025/Windows 11.
- Navigate to SQL Server Services > [Your Instance] > Properties > Startup Parameters.
- Ensure no duplicate
-T(trace flag),-d,-l, or-eparameters exist in the startup parameter list. - Remove any redundant entries and click Apply, then restart the SQL Server service.
Step 4: Update and Recompile Affected Stored Procedures
- Run
sp_helptext 'ProcedureName'to review the full procedure definition for duplicate parameter declarations. - Use
ALTER PROCEDUREto remove redundant parameter references. - Recompile with
EXEC sp_recompile 'ProcedureName';to clear any cached execution plans referencing the faulty syntax.
Step 5: Clear and Rebuild Plan Cache (If Issue Persists)
- Run
DBCC FREEPROCCACHE;to clear cached query plans that may be retaining the malformed argument structure. - Restart the SQL Server service via services.msc or
net stop MSSQLSERVER && net start MSSQLSERVER.
Alternative or Verification Steps
- Re-run the original query, stored procedure, or command-line utility and confirm Error 11712 no longer appears in the SQL Server Error Log or Event Viewer.
- If the error persists, temporarily revert to a simplified version of the script (removing optional/named parameters) to isolate whether the issue stems from application code versus an internal SQL Server bug, and consider applying the latest SQL Server 2025 Cumulative Update via Windows Update or the Microsoft Download Center.