# Microsoft SQL Server Microsoft SQL Server Troubleshooting

Source: https://userguide.qualytics.io/source-datastore/datastore/jdbc/microsoft-sql-server/troubleshooting/

When **Test connection** or an operation fails on a SQL Server datastore, the error message points to the layer that failed: the sign-in, the database permissions, or the connection to the server.

> **Info: Problems every connector shares**
>
> A server that cannot be reached, a red status dot, a credential changed at the source, Secrets Management errors, an empty schema list, missing tables, and a blocked deletion are covered on [Source Datastore Troubleshooting](https://userguide.qualytics.io/source-datastore/datastore/troubleshooting/). This page covers the errors specific to Microsoft SQL Server.

## Common Errors

| Error | Likely Cause | Fix |
| --- | --- | --- |
| `Login failed for user` | Incorrect username or password, or the login does not exist | Verify the login exists at the server level with `SELECT name FROM sys.sql_logins` |
| `Cannot open database requested by the login` | The user does not have access to the specified database | Ensure a user is mapped to the login in the target database with `CREATE USER ... FOR LOGIN` |
| `The SELECT permission was denied on object` | The user lacks `SELECT` on one or more tables in the schema | Run `GRANT SELECT ON SCHEMA::<schema_name> TO <user>` |
| `CREATE TABLE permission denied in database` | The enrichment user lacks `CREATE TABLE` permission | Run `GRANT CREATE TABLE TO <user>` |
| `Cannot find the object because it does not exist or you do not have permissions` | The user lacks `VIEW DEFINITION` on the schema | Run `GRANT VIEW DEFINITION ON SCHEMA::<schema_name> TO <user>` |

## Detailed Notes

### Authentication Errors

The error `Login failed for user` indicates that the credentials are incorrect or the login does not exist at the server level.

Common causes:

- **Incorrect password**: the password does not match the one set for the login.
- **Login does not exist**: the login was never created at the server level with `CREATE LOGIN`.
- **User not mapped**: the login exists but no user is mapped to it in the target database.
- **Service Principal misconfiguration**: when using Entra ID authentication, the Client ID, Client Secret, or Tenant ID is incorrect.

> **Note**
>
> SQL Server distinguishes between **logins** (server-level) and **users** (database-level). A login must exist at the server level, and a corresponding user must be created in each target database.

### Permission Errors

The error `The SELECT permission was denied on object` means the user authenticated successfully but lacks the necessary grants on the target schema.

Common causes:

- **Missing `SELECT ON SCHEMA`**: the user does not have `SELECT` on the target schema.
- **Wrong schema**: the user has permissions on `dbo` but the target tables are in a different schema.
- **Missing `VIEW DEFINITION`**: the user cannot see the definitions of the tables and views inside the schema.

### Connection Errors

The error `Cannot open database requested by the login` means the user does not have access to the specified database.

Common causes:

- **No user in database**: the login exists but `CREATE USER ... FOR LOGIN` was not run in the target database.
- **Database does not exist**: the database name in the connection form is incorrect.
- **Database is offline**: the target database is in a recovery or offline state.

### Scanning Actively Updated Tables

If a SQL Server database is updated by another process while Qualytics scans it (for example, an operational or reporting database with scheduled data loads, such as an Epic Clarity environment), a scan can occasionally fail partway through with a message that the connection was interrupted. This happens when the source ends the read session, often during a maintenance or data-load window, rather than because of a data-quality or connection problem. Re-running the scan usually succeeds.

To reduce these interruptions:

- Schedule scans to run outside the source's maintenance or data-load window.
- Use an incremental scan on large, frequently updated tables so each run reads only new or changed records.
- If the source is heavily loaded during your scan window, point the datastore at a read replica or reporting copy.

Qualytics reads SQL Server without blocking writes, so scanning does not lock the tables being read. For the full walkthrough, see [Scan Troubleshooting](https://userguide.qualytics.io/operations/scan/troubleshooting/#connection-interrupted-during-a-scan).

*Last updated: November 17, 2026.*
