SSRS Asc Function

The SSRS Asc and AscW functions are Text functions that return the ASCII code or value of the leftmost character in a given string field. This article explains how to use the Asc and AscW functions to find the character code in a table column with an example.

The syntax of the SSRS Asc and AscW functions to find the character ASCII code is as shown below.

Asc(Fields!FulName.Value)
AscW(Fields!FulName.Value)

To demonstrate the SSRS Asc and AscW functions, we use the Employee table below, which has 15 records grouped by Occupation. The image shows the records in the Table report.

Source Table

SSRS Asc function Example

For this, let me add a new column to the right side of the Name column. Next, right-click the textbox under the Name Asc and choose the Expression. To understand the report, I suggest you refer to the articles on charts, tables, grouping, and format tables in SSRS.

Choose the expression option

It opens the following expression window to find a character’s ASCII value. The SSRS Asc function code below will return the ASCII value of the leftmost character in a Name column.

=Asc(Fields!Name.Value)
SSRS Asc Function expression to find the ASCII code of a character

Please click the preview tab to see the character codes of the name column’s first character. C = 67, R = 82, P = 80, and G = 71. For more functions >> Click Here!

SSRS Asc Function to find the ASCII character code preview

Let me create one more new column and name it Asc2. Next, right-click the textbox under it to write the expression below. Here, the Right function returns the rightmost character, and the Asc function returns the ASCII code of the rightmost character.

=Asc(Right(Fields!Name.Value, 1))

If you check the report preview, a (last character from Christy Mehta) = 97, f = 102, s = 115, and n = 110.

SSRS Asc Function to find the ASCII character code report preview