Get your business online with free website builder (en)

Use of RIGHT Function in SQL

Use of RIGHT Function in SQL:

(1) “Right” function is used to get a number of characters from a string that’s starting from right.

(2) Let’s take an example to get a character from the Vendor Name as shown.

(3) Select the database in the SQL server and click on the “New Query” button as shown.

Select the database in the SQL server and click on the new query button

(4) After that new query editor opens as shown.

new query editor open in sql

(5) After doing the above steps, write a query in the editor, as shown.

right function query in sql

Source Code:

–//RIGHT is used to get character from string
Select [No_] AS [Vendor No.],[Name] AS [Vendor Name],
RIGHT([Name],3)AS [RIGHT(Character from string)]
Fromdbo.[CRONUS India Ltd_$Vendor$437dbf0e-84ff-417a-965d-ed2bb9650972] 
–//RIGHT is used to get character from string

(6) Then Execute or Press F5 to run the query and see the result as shown.

execute right function query in sql

Use of LEFT Function in SQL
RIGHT (Transact-SQL)– Microsoft Docs
Take Database Backup via SQL Query in SQL Server
Use of STORED PROCEDURES in SQL

Leave a Reply