An Exception Occurred While Executing a Transact-SQL Statement or Batch. … The most usual causes include the customer trying to connect to an incorrect version of SQL Server, the server being too down to accept new connections, or a limited amount of resources on the server.

You can get this message An Exception Occurred While Executing a Transact-SQL Statement or Batch, if you are using SQL Server express with Windows Vista or Windows 7 and the user mode is Windows. This error can happen if the actual user is not an operator. If the current user is an operator, right-click on SQL Server Management Studio and run it as an operator. This error will be gone.

Case 1 of An Exception Occurred While Executing a Transact-SQL Statement or Batch

An Exception Occurred While Executing a Transact-SQL Statement or Batch

From technical point of view, when the Next button is click for the first time on System Configuration Wizard on step you follow up:

Resolve 1:

To get around this problem, An Exception Occurred While Executing a Transact-SQL Statement or Batch just try it this way:

  1. On the error. Click OK
  2. SM is the OOTB value for the Application Name column.
  3. Go to page 3 by clicking Next.
  4. Click Previous to return to page 2 after page 3 has loaded.
  5. The Application Name field can now be re-customized.
  6. To finish the installation, click Next to page 3 once more than usual.

Case 2 of An Exception Occurred While Executing a Transact-SQL Statement or Batch

Coming late to your desktop, and you  found this An Exception Occurred While Executing a Transact-SQL Statement or Batch on getting control of your SQL Express instance if you don’t have your “sa” password. You have to  use this process to not only reset my “sa” password, but you also added your domain account to all the available server roles. Now you  can create databases, alter logins, do bulk operations, backups/restores, etc. using your normal login.

an exception occurred while executing a transact-sql statement or batch

Resolve 2:

To sum it all up, an Exception Occurred While Executing a Transact-SQL Statement or Batch to put your instance into single-user mode to solve this. An Exception Occurred While Executing a Transact-SQL Statement or Batch, because once you connect, this enhances you to systems administrator, allowing you to customize everything.

Edit: I’ve copied the steps below – kudos to the original author of the link above.

  1. Log on to the computer as an Administrator (or Any user with administrator privileges)
  2. Open “SQL Server Configuration Manager”
  3. Click “SQL Server Services” on the left pane
  4. Stop “SQL Server” and “SQL Server Agent” instance on the right pane if it is running
  5. Run the SQL Express in single-user mode by right-clicking on “SQL Server” instance → Properties (on the right pane of SQL Server Configuration Manager).
  6. Click Advanced Tab, and look for “Startup Parameters”. Change the “Startup Parameters” so that the new value will be -m; (without the <>) example: from: -dc:\Program Files\Microsoft SQL………….(til end of string) to: -m;-dc:\Program Files\Microsoft SQL………….(til end of string)
  7. Start the SQL Server
  8. Open your MS SQL Server Management Studio and log on to the SQL server with “Windows Authentication” as the authentication mode. Since we have the SQL Server running on single user mode, and you are logged on to the computer with Administrator privileges, you will have a “sysadmin” access to the database.
  9. MS SQL Server Management Studio’s left pane contains the “Security” column.
  10. Increase the size of the “Connections” niche.
  11. Double-click the’sa’ login to open it.
  12. If “Enforce password policy” is checked, change the password by entering a passcode; alternatively, just enter any password.
  13. Make sure the “sa” profile is “activated” by selecting “Status” in the left window. Set the radio box below “Login” to “Enabled”.
  14. Click on”OK”.
  15. Returning to the MS SQL Server Management Studio main window, check if SQL Server certification is in use by right-clicking.