Fonction SQL Server RIGHT()
Exemple
Extraire 3 caractères d'une chaîne (en partant de la droite) :
SELECT RIGHT('SQL Tutorial', 3) AS ExtractString;
Définition et utilisation
La fonction RIGHT() extrait un certain nombre de caractères d'une chaîne (en commençant par la droite).
Syntaxe
RIGHT(string, number_of_chars)
Valeurs des paramètres
Parameter | Description |
---|---|
string | Required. The string to extract from |
number_of_chars | Required. The number of characters to extract. If number_of_chars > string, it returns string |
Détails techniques
Travaille dans: | SQL Server (à partir de 2008), Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse |
---|
Plus d'exemples
Exemple
Extrayez 5 caractères du texte de la colonne "CustomerName" (en partant de la droite) :
SELECT RIGHT(CustomerName, 5) AS ExtractString
FROM Customers;
Exemple
Extraire 100 caractères d'une chaîne (en partant de la droite) :
SELECT RIGHT('SQL Tutorial', 100) AS ExtractString;