---
title: "Remove a Server-Wide Connection String"
url: "https://docs.ravendb.net/7.2/integrations/connection-strings/server-wide/remove-connection-string"
version: "7.2"
language: "csharp"
---

# Remove a Server-Wide Connection String

> Client language: C#.
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

> **Note**
>
> - Use `RemoveServerWideConnectionStringOperation` to remove a server-wide connection string from the cluster.
>
> - Removing a server-wide connection string deletes both:
>   - The cluster-level definition.
>   - The propagated connection string entries from all databases that received it.
>
> - A server-wide connection string **cannot** be removed while it is still used by an ongoing task or AI agent in any database.
>   Before removing it, delete or update the tasks and AI agents that reference it.
>
> - To remove a server-wide connection string from Studio, open **Manage Server > Server-Wide Connection Strings**  
>   and use the delete action in the list view.
>   See [Managing server-wide connection strings](https://docs.ravendb.net/7.2/integrations/connection-strings/server-wide/overview.md#managing-server-wide-connection-strings).
>
> - In this article:
>   - [Remove a server-wide connection string](#remove-a-server-wide-connection-string)
>   - [Syntax](#syntax)

## Remove a server-wide connection string {#remove-a-server-wide-connection-string}

The following example removes a RavenDB server-wide connection string.  
Only the `Name` property is required; the type is inferred from the connection string class.

### Sync

```csharp
var ravenConnectionString = new RavenConnectionString()
{
    // Only the 'Name' property is needed for the remove operation.
    Name = "ravendb-connection-string-name"
};

// Define the remove operation, pass the connection string to be removed.
var removeOp =
    new RemoveServerWideConnectionStringOperation<RavenConnectionString>(ravenConnectionString);

// Execute the operation through the server maintenance store.
RemoveServerWideConnectionStringResult result = store.Maintenance.Server.Send(removeOp);
```

### Async

```csharp
var ravenConnectionString = new RavenConnectionString()
{
    // Only the 'Name' property is needed for the remove operation.
    Name = "ravendb-connection-string-name"
};

// Define the remove operation, pass the connection string to be removed.
var removeOp =
    new RemoveServerWideConnectionStringOperation<RavenConnectionString>(ravenConnectionString);

// Execute the operation through the server maintenance store.
RemoveServerWideConnectionStringResult result = await 
    store.Maintenance.Server.SendAsync(removeOp);
```

## Syntax {#syntax}

```csharp
public RemoveServerWideConnectionStringOperation(T connectionString) where T : ConnectionString
```

| Parameter | Type | Description |
| - | - | - |
| **connectionString** | `T` | Connection string to remove (only `Name` is required):<br />`RavenConnectionString`<br />`SqlConnectionString`<br />`SnowflakeConnectionString`<br />`OlapConnectionString`<br />`ElasticSearchConnectionString`<br />`QueueConnectionString`<br />`AiConnectionString` |

| Operation result | |
| - | - |
| `RemoveServerWideConnectionStringResult` | Contains `RaftCommandIndex` - the Raft index assigned to the operation. |
