tencent cloud

TencentDB for SQL Server

Stored Procedure Overview

Baixar
Modo Foco
Tamanho da Fonte
Última atualização: 2026-11-19 18:03:45
Traduzido e Verificado por IA

Feature Overview

To ensure instance stability and security, TencentDB for SQL Server does not grant users server-level privileged roles such as sysadmin. For operations that originally require elevated permissions, the platform provides a set of system stored procedures in the instance, which are exposed after internal permission control and security validation. After connecting to the instance through clients such as SSMS or database management tools (DMC), you can directly execute T-SQL to perform these operations on your own.
This document summarizes all currently available stored procedures, introducing their features, general calling methods, and usage limitations. For the parameters, return values, and complete examples of each stored procedure, see the corresponding user manual.

Differences Between Stored Procedures, the Console, and APIs

Some features support three methods simultaneously: the console, TencentCloud API, and stored procedures. You can choose based on your use case:
Method
Operator
Scenario
Description
Console
Administrator with Tencent Cloud account (including sub-account) permissions
Daily Ops, low-frequency operations, and changes that require visual confirmation.
Operations are controlled by CAM permissions, and change records can be queried in the console.
TencentCloud API
Ops platforms and automation scripts
Batch instance management and integration with your own Ops system.
TencentCloud API key authentication is required. For more information, see API Overview.
Stored procedure
DBAs, developers, and applications with database accounts
Complete operations within a database session; integrate with application release scripts and SQL Agent jobs; retain T-SQL Ops habits after migrating from self-managed SQL Server.
No Tencent Cloud account or API key is required. Only the database account needs the EXECUTE permission on the corresponding stored procedure.

Stored Procedure List

The currently available stored procedures are as follows. Before calling them, pay special attention to the Database column: different stored procedures are deployed in different system databases, and their calling methods vary. For details, see Calling by Database.
Category
Stored procedure
Feature Description
Database
User Manual
Modifying the account password
tencentdb_ChangeLoginPassword
Self-service password change for SQL Server authentication logins (SQL Logins) without the sysadmin role.
master
Configuring instance parameters
sp_rds_configure
Set instance-level configuration parameters. Currently, 15 parameters are available.
master
Data import
TencentSp_DownloadFromCOS
Download files from Tencent Cloud Object Storage (COS) to a fixed local directory on the instance for subsequent import. It can also be used to clean up expired local files.
monitor
TencentSp_BulkInsertFromFile
Import files downloaded to the local device into the specified user database table in batches via BULK INSERT. CSV, TSV, and format files are supported.
monitor
Note:
This document lists only the stored procedures officially provided by the platform. Other objects in system databases such as master and monitor are reserved for platform Ops use and may change with version updates, so do not rely on them in your business. Newly available stored procedures will be updated in this document accordingly.

Selection by Scenario

I want to change the password of an application account without using a high-privilege account: Change Account Password. Use tencentdb_ChangeLoginPassword, which is suitable for scenarios where applications rotate passwords regularly or account owners change passwords on their own.
I want to adjust instance parameters such as parallelism, timeout, and session default options: Configure Instance Parameters. Use sp_rds_configure, which can be executed directly in deployment scripts and has usage similar to sp_configure in self-built SQL Server.
I have a large number of CSV/TSV data files to import into database tables: Import Data from COS in Batches. First use TencentSp_DownloadFromCOS to download the files, and then use TencentSp_BulkInsertFromFile to import them in batches.

Prerequisites

1. Connected to the instance: Connect to the TencentDB for SQL Server instance through clients such as SSMS or database management tools (DMC). See Connecting to SQL Server Instance and Introduction to DMC SQL Window.
2. Have EXECUTE permission: The database account used for invocation must have the EXECUTE permission on the target stored procedure. For account permission details, see Account Types and Permissions.
3. Confirm the database: Select the correct calling method based on the Database column in the stored procedure list.

General Call Instructions

Calling by Database

The name prefix and database of a stored procedure determine whether a database switch is required when it is called:
Stored procedure
Database
Call Method
sp_rds_configure
master
If the name starts with sp_, SQL Server automatically resolves it in the master database, and it can be directly called in any database.
tencentdb_ChangeLoginPassword
master
Execute USE master first, or use the three-part name master.dbo.tencentdb_ChangeLoginPassword.
TencentSp_DownloadFromCOS
TencentSp_BulkInsertFromFile
monitor
Execute USE monitor first, or use the three-part name monitor.dbo.<stored procedure name>.
-- Method 1: For stored procedures starting with sp_ in the master database, call them directly from any database
EXEC sp_rds_configure @config_name = N'max degree of parallelism', @config_value = 4;

-- Method 2: Switch to the database where the stored procedure resides and then call it
USE master;
EXEC dbo.tencentdb_ChangeLoginPassword @login = N'myapp_user', @new_password = N'<new password>';

-- Method 3: Call using a three-part name without switching databases
EXEC monitor.dbo.TencentSp_DownloadFromCOS
@BucketName = 'mybucket-1258888888',
@FileName = 'data/sales_2024.csv',
@Region = 'ap-guangzhou';

Checking Stored Procedure Availability

If Could not find stored procedure is prompted during execution, use the following statement to check whether the stored procedure has been deployed on the current instance and whether the current account has EXECUTE permission:
-- Query platform stored procedures in the master database
SELECT name, create_date, modify_date
FROM master.sys.procedures
WHERE name IN (N'sp_rds_configure', N'tencentdb_ChangeLoginPassword');

-- Query platform stored procedures in the monitor database
SELECT name, create_date, modify_date
FROM monitor.sys.procedures
WHERE name LIKE N'TencentSp[_]%';

-- Check the current account's execute permission on the stored procedure (1 means yes, 0 means no)
SELECT HAS_PERMS_BY_NAME(N'master.dbo.tencentdb_ChangeLoginPassword', N'OBJECT', N'EXECUTE') AS can_execute;

Update records

Time
Stored procedure
Description
2026-11
sp_rds_configure
Added a stored procedure for configuring instance parameters, with 15 instance-level parameters available.
2026-08
tencentdb_ChangeLoginPassword
Added a stored procedure for changing account passwords, allowing users to change SQL Login passwords on their own.
2026-06
TencentSp_DownloadFromCOS
TencentSp_BulkInsertFromFile
Added a stored procedure for importing data from COS in batches.

Ajuda e Suporte

Esta página foi útil?

comentários