Troubleshooting Guide: SQL Server Error 966 — Assembly Name Conflict with System Assembly
Why This Error Happens
This warning occurs when a CLR assembly stored in a user database has the same name as one of the reserved system assemblies shipped with SQL Server 2025 (such as internal framework or Microsoft.SqlServer.* assemblies). During database upgrade or attach/restore operations, SQL Server detects this naming collision and automatically renames the user assembly by appending a suffix to avoid overwriting or conflicting with the system assembly. This typically surfaces after migrating databases from older SQL Server versions where CLR assembly naming conventions were less restrictive, or when custom SQLCLR assemblies were deliberately named after internal components.
Step-by-Step Resolution Guide
Step 1: Identify the Renamed Assembly and Its New Name
- Run the following query to locate affected assemblies in the database referenced by the error:
SELECT name, assembly_id, clr_name FROM sys.assemblies WHERE is_user_defined = 1;- Cross-reference the original name reported in the Error 966 message with the new name now present in
sys.assemblies. - Check SQL Server Error Log (
ERRORLOG) or Event Viewer under Windows Logs > Application for the full text of the Event ID 966 entry, including both old and new assembly names.
Step 2: Update Dependent Objects and References
- Any stored procedures, functions, triggers, or application connection strings that explicitly reference the old assembly name by exact name will break — update these references.
- Run this query to find dependent CLR objects:
SELECT o.name, o.type_desc, a.name AS assembly_name FROM sys.objects o JOIN sys.assembly_modules am ON o.object_id = am.object_id JOIN sys.assemblies a ON am.assembly_id = a.assembly_id;- Update any deployment scripts, SSDT/DACPAC projects, or CI/CD pipelines that reference the assembly by its original name.
Step 3: Rename the Assembly Back to a Non-Conflicting Custom Name (Optional but Recommended)
- Instead of leaving the auto-generated suffixed name, explicitly rename it to something clearly distinct from any system assembly:
ALTER ASSEMBLY [OldConflictingName_1] WITH NAME = N'YourCompany_CustomAssemblyName';- Choose a naming convention (e.g., prefixing with your company or project name) to prevent future collisions during upgrades to later SQL Server versions.
- If the assembly needs to be fully redeployed, drop and re-add it using
CREATE ASSEMBLYwith the new safe name and re-link it to its original DLL/.dll binary orCREATE ASSEMBLY FROM 0x...binary stream.
Step 4: Validate CLR Integration Settings
- Confirm CLR integration is still enabled post-upgrade, as renamed assemblies can sometimes coincide with configuration resets:
EXEC sp_configure 'clr enabled', 1; RECONFIGURE;- Verify
clr strict securitysettings insp_configure, since SQL Server 2025 enforces stricter assembly trust validation by default.
Alternative or Verification Steps
- Verify the fix by querying
sys.assembliesagain and confirming the assembly name no longer triggers a warning on database restart or re-attach; also re-check the SQL Server Error Log for recurrence of Event ID 966. - If application connectivity still fails after renaming, consider dropping and recreating the assembly entirely using
DROP ASSEMBLYfollowed by a freshCREATE ASSEMBLYunder a guaranteed unique name, then re-link all dependent CLR stored procedures/functions.