---
title: "Dynamic Query to Update Vault"
slug: "dynamic-query-to-update-vault"
updated: 2024-08-09T11:49:17Z
published: 2024-08-09T11:49:17Z
canonical: "help.symphonysummitai.com/dynamic-query-to-update-vault"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://help.symphonysummitai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Dynamic Query to Update Vault

Use the below SQL statements for "Dynamic Query to Update Vault".

**DECLARE @Provider NVARCHAR(255),@URL NVARCHAR(255), @sql NVARCHAR(max),@Token NVARCHAR(255),@vaultname NVARCHAR(255),**

**@DBname NVARCHAR(255),@servername NVARCHAR(255),@User NVARCHAR(255),@PW NVARCHAR(255)**

Change the below values as per your instance.

- **SET @Provider = 'hashicorp'**  
If needed replace 'hashicorp' with the provider name.
- **SET @URL = 'http://10.63.0.5:8200'**   
If needed replace 'http://10.63.0.5:8200' with the new URL.
- **SET @Token =** **'hvs.Xg2d2iQpRVMnmICUfnkthexq'**  
If needed replace 'hvs.Xg2d2iQpRVMnmICUfnkthexq' with the new token name.
- **SET @vaultname = 'stgsymphonyindustrial'**  
If needed replace 'stgsymphonyindustrial' with the new vault name.
- **SET @DBname = 'Stgsymphonyindustrial'**   
If needed replace 'Stgsymphonyindustrial' with the new DB name.
- **SET @servername = 'apexwepocsql01'**  
If needed replace 'apexwepocsql01' with the new server's name or IP address.
- **SET @User = 'db_demo'**   
If needed replace 'db_demo' with the new login username.
- **SET @PW = 'Welcome@123'**   
If needed replace 'Welcome@123' with the new password.
- **SET @Provider = ''**

| set @sql = ' update plt_app_setting set setting_value = ''{"Provider":"[#Provider#]","Hashicorp":{"VaultEndpointUri":"[#URL#]","Token":"[#Token#]","VaultEngine":"kv","VaultName":"[#Vaultname#]","AppRoleId":"","AppRoleSecret":"","BootstrapToken":"","AdminUserName":"","AdminUserPassword":"","ByPassVault":""},"Azure":{"TenantId":"","VaultUri":"","ClientId":"","ClientSecret":""},"Summit":{"RootKey":"","Database":"","ConnectionString":"Data Source=[#servername#];initial Catalog=[#DBName#];User Id=[#user#];Password=[#PW#]"}}'' where setting_key = ''Vault''; update plt_vault set secret_value = ''Data Source=[#servername#];initial Catalog=[#DBName#];User Id=[#user#];Password=[#PW#]'' where id =2; '; SET @sql = Replace(@sql,'[#username#]',@user) SET @sql = Replace(@sql,'[#Provider#]',@Provider) SET @sql = Replace(@sql,'[#URL#]',@URL) SET @sql = Replace(@sql,'[#Token#]',@Token) SET @sql = Replace(@sql,'[#Vaultname#]',@vaultname) SET @sql = Replace(@sql,'[#servername#]',@servername) SET @sql = Replace(@sql,'[#DBName#]',@DBname) SET @sql = Replace(@sql,'[#user#]',@User) SET @sql = Replace(@sql,'[#PW#]',@PW) PRINT (@sql); EXEC (@sql); |
| --- |
