Use of ASCII function in SQL

Use of ASCII function in SQL:

(1) “ASCII” function is used to get the first ASCII value of a string.

(2) Let’s take an example to get the ASCII value of Vendor Name from Vendor table as shown.

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

Select the database in SQL server and click on the New Query

(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.

sql query for ascii function

Source Code:

–//ASCII Value get from Vendor Name field
Select [No_] as [Vendor No.],[Name] as [Vendor Name],
ASCII(Name)as [ASCII Value of Vendor Name]
fromdbo.[CRONUS India Ltd_$Vendor$437dbf0e-84ff-417a-965d-ed2bb9650972]
–//ASCII Value get form Vendor Name field

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

execute the sql query for ASCII function

How to get Data from SQL View in Excel Sheet
Create Database via query in SQL Server
Usage of COMMIT in BC D365
Database.Commit() Method– Microsoft Docs

Leave a Reply