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

Troubleshooting Guide: SQL Server Error 2243 – “Relative path expression used without any context”

Why This Error Happens

This error typically occurs when SQL Server encounters a relative file path (such as .\Data\file.mdf or ..\Backup\file.bak) during an operation like RESTORE, BACKUP, or CREATE DATABASE, but no base directory context has been established for resolving it. This commonly happens when a script or application passes a relative path to a stored procedure, SSIS package, or T-SQL command without SQL Server having an active working directory reference. It can also surface due to corrupted or misconfigured SSIS package connection managers that fail to pass the absolute path context at runtime.

Step-by-Step Resolution Guide

Step 1: Identify the Source of the Relative Path

  • Check the T-SQL script, stored procedure, or application log that triggered Error 2243.
  • Look for file paths that do not start with a drive letter (e.g., .\Backups\db.bak instead of C:\SQLData\Backups\db.bak).
  • Run sp_helptext on any suspected stored procedures to inspect path variables.

Step 2: Convert All Paths to Fully Qualified Absolute Paths

  • Update backup/restore commands to use full paths, for example:
RESTORE DATABASE [YourDB]
FROM DISK = N'C:\SQLServer\Backup\YourDB.bak'
WITH REPLACE;
  • If using SSIS, open the package in SQL Server Data Tools (SSDT) and verify the ConnectionString property in each Connection Manager uses an absolute path rather than an expression-based relative reference.
  • For CREATE DATABASE or ALTER DATABASE commands, ensure the FILENAME parameter specifies the full directory path (e.g., C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\).

Step 3: Validate SQL Server Service Account Permissions

  • Open Services.msc on Windows Server 2025 / Windows 11 and confirm the SQL Server service account has Read/Write access to the target directory.
  • Right-click the target folder (e.g., C:\SQLData) → Properties → Security tab → ensure NT SERVICE\MSSQLSERVER (or your custom service account) has Modify permissions.
  • Restart the SQL Server service after permission changes:
Restart-Service -Name 'MSSQLSERVER'

Step 4: Review SSIS Package Expressions (If Applicable)

  • Open the SSIS package in Visual Studio/SSDT and navigate to the Connection Manager properties.
  • Check the Expressions section for any dynamically built paths using string concatenation that may resolve to an empty or relative value at runtime.
  • Replace expression-driven paths with validated absolute path variables defined in the Package Parameters or Project Parameters.

Alternative or Verification Steps

  • Re-run the original BACKUP, RESTORE, or CREATE DATABASE command with the corrected absolute path and confirm Error 2243 no longer appears in SQL Server Management Studio (SSMS) or the SQL Server Error Log (EXEC xp_readerrorlog).
  • If the error persists in an SSIS package, execute the package manually via dtexec with verbose logging (/Rep V) to capture the exact path value being passed at runtime for further diagnosis.