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

Troubleshooting Guide: Error 268 — “Cannot run SELECT INTO in this database”

Why This Error Happens

This error is a legacy holdover from older SQL Server compatibility logic tied to the deprecated sp_dboption system stored procedure, which no longer functions natively in modern SQL Server versions like SQL Server 2025. It typically occurs when a database was migrated or restored from a much older SQL Server instance (pre-2008) where the select into/bulkcopy database option was never explicitly enabled, or when the database compatibility level is set incorrectly. In rare cases, this can also surface if the database is stuck in a restricted state (such as read-only or single-user mode) that prevents the SELECT INTO operation from creating the underlying table object.

Step-by-Step Resolution Guide

Step 1: Verify the Database Compatibility Level

  • Open SQL Server Management Studio (SSMS) and connect to the instance.
  • Right-click the target database, select Properties, and navigate to the Options page.
  • Check the Compatibility Level field; if it is set to a very old value (e.g., SQL Server 2000 – 80), this can trigger legacy restrictions.
  • Update it to a modern level (e.g., SQL Server 2025 - 170) using the dropdown, or run:
  ALTER DATABASE [YourDatabaseName] SET COMPATIBILITY_LEVEL = 170;

Step 2: Replace Deprecated sp_dboption Syntax

  • Since sp_dboption is removed/non-functional in modern builds, you must use ALTER DATABASE instead.
  • Open a New Query window in SSMS connected to the master database.
  • Run the following command to explicitly enable the required setting (mapped from the old select into/bulkcopy option):
  ALTER DATABASE [YourDatabaseName] SET RECOVERY BULK_LOGGED;
  • Ensure the database is not currently in FULL recovery mode if bulk operations are failing due to logging constraints, unless recovery requirements dictate otherwise.

Step 3: Check Database State and Permissions

  • Verify the database is not in Read-Only mode, as this will block the creation of new tables via SELECT INTO.
  • Run the following diagnostic query to check the current state:
  SELECT name, is_read_only, state_desc 
  FROM sys.databases 
  WHERE name = 'YourDatabaseName';
  • If is_read_only returns 1, disable it using:
  ALTER DATABASE [YourDatabaseName] SET READ_WRITE;
  • Confirm your login has the db_owner role or ALTER permissions on the database via Security > Logins in SSMS.

Step 4: Restart the SQL Server Service

  • Open Services.msc on the Windows Server 2025 / Windows 11 host.
  • Locate SQL Server (MSSQLSERVER) or the named instance.
  • Right-click and select Restart to clear any cached execution plans or session locks related to the old compatibility settings.

Alternative or Verification Steps

  • Verify the Fix: Run a simple test query, such as SELECT * INTO #TempTest FROM sys.objects;, in the affected database to confirm the operation completes without Error 268.
  • Alternative Solution: If the error persists after changing compatibility levels, script out the database schema and data, create a brand-new database on the SQL Server 2025 instance, and migrate the data via the Import/Export Wizard to bypass legacy configuration conflicts entirely.