Fonction SQL Server STUFF()
Exemple
Supprimez 3 caractères d'une chaîne, en commençant à la position 1, puis insérez "HTML" à la position 1 :
SELECT STUFF('SQL Tutorial', 1, 3, 'HTML');
Définition et utilisation
La fonction STUFF() supprime une partie d'une chaîne, puis insère une autre partie dans la chaîne, en commençant à une position spécifiée.
Astuce : Regardez également la fonction REPLACE() .
Syntaxe
STUFF(string, start, length, new_string)
Valeurs des paramètres
Parameter | Description |
---|---|
string | Required. The string to be modified |
start | Required. The position in string to start to delete some characters |
length | Required. The number of characters to delete from string |
new_string | Required. The new string to insert into string at the start position |
Détails techniques
Travaille dans: | SQL Server (à partir de 2008), Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse |
---|
Plus d'exemples
Exemple
Supprimez 1 caractère d'une chaîne, en commençant à la position 13, puis insérez " c'est amusant !" en position 13 :
SELECT STUFF('SQL Tutorial!', 13, 1, ' is fun!');