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
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:
- On the error. Click OK
- SM is the OOTB value for the Application Name column.
- Go to page 3 by clicking Next.
- Click Previous to return to page 2 after page 3 has loaded.
- The Application Name field can now be re-customized.
- 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.
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.
- Log on to the computer as an Administrator (or Any user with administrator privileges)
- Open “SQL Server Configuration Manager”
- Click “SQL Server Services” on the left pane
- Stop “SQL Server” and “SQL Server Agent” instance on the right pane if it is running
- 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).
- 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)
- Start the SQL Server
- 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.
- MS SQL Server Management Studio’s left pane contains the “Security” column.
- Increase the size of the “Connections” niche.
- Double-click the’sa’ login to open it.
- If “Enforce password policy” is checked, change the password by entering a passcode; alternatively, just enter any password.
- Make sure the “sa” profile is “activated” by selecting “Status” in the left window. Set the radio box below “Login” to “Enabled”.
- Click on”OK”.
- Returning to the MS SQL Server Management Studio main window, check if SQL Server certification is in use by right-clicking.