Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Thread Tools Search this Thread
Old 10-11-2008
Join Date: Mar 2008
Posts: 116
ASCII Code Table in SQL

The following procedure gets the Ascii Conversion Table and displays all the ASCII code starting from 0 to 255. The procedure takes an int type argument and will show the ASCII code starting from that particular number.

Let's assume if we want to display the ASCII table starting from 100 till 255, then we will call the procedure using

exec convASCII 100


@counter int -- Argument describing the starting number for the table


DECLARE @col int, @strline varchar(3000) -- strline is going to store the ASCII code table

SET @col = 0

SET @strline = ' '

-- Let's make a loop starting from the counter variable till 255.

WHILE @counter <= 255


We are making the table to display 10 ASCII codes in a row i.e. 10 columns in one row.

WHILE @col < 10


SET @strline = @strline + ' | ' + convert(varchar(4), @counter)+ ' - ' + CHAR(@counter) -- Displaying the ASCII code and the character code in the table. CHAR converts the int ASCII code to character. CONVERT function converts the second argument type to the data type provided in the first argument.

SET @counter=@counter+1 - increment the counter
SET @col = @col + 1 - increment the column
SET @strline = CHAR(9) + @strline + ' | ' + CHAR(13) -- Char(9) is the TAB key and CHAR(13) is for Carriage Return

SET @col = 0
PRINT @strLine -- Display the ASCII Codes.
Reply With Quote
Old 10-11-2008
Join Date: May 2008
Posts: 39
Re: ASCII Code Table in SQL

ASCII reserves the first 32 codes (numbers 0?31 decimal) for control characters: codes originally intended not to carry printable information, but rather to control devices (such as printers) that make use of ASCII, or to provide meta-information about data streams such as those stored on magnetic tape. For example, character 10 represents the "line feed" function (which causes a printer to advance its paper), and character 8 represents "backspace". Control characters that do not include carriage return, line feed or white space are called non-whitespace control characters.
Reply With Quote

  TechArena Community > Software > Software Development
Tags: ,

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads for: "ASCII Code Table in SQL"
Thread Thread Starter Forum Replies Last Post
Link a Table to another Table to Drop Down In Main Table himeshRES Windows Software 6 11-12-2010 02:01 PM
Html program code for table Sonam Goenka Software Development 6 29-12-2009 08:03 AM
Full Ascii table for reference MindSpace Software Development 3 12-01-2009 10:56 AM
How to use the ASCII code on SONY VAIO Laptop NavinS Portable Devices 3 23-12-2008 02:53 PM
C++ program to display ASCII code of a word or phrase Sonic Software Development 2 12-11-2008 01:09 PM

All times are GMT +5.5. The time now is 07:05 PM.