Friday, October 24, 2014

PRINTING ASCII VALUES BY USING STORED PROCEDURES

ASCII VALUES: ASCII  VALUES RANGE FROM   "0 TO 255"

SPECIAL CHARACTERS: RENGE 32 TO 64  LIKE !,

SMALL ALPHABETS: RANGE FROM 96 TO 122

CAPITAL ALPHABETS:RANGE FROM 64 TO 90

CHAR( ):Converts an int ASCII code to a character..   
             
                  SYNTAX:  CHAR(integer-expression)
          
 EX: SELECT   CHAR(9)  ------TAB
         SELECT  CHAR(10) -----LINE FEED
          SELECT   CHAR(13)  ----CARRIAGE RETURN
          SELECT   CHAR(39)-----SINGLE COTATION

--GENRALLY WE R USING THIS CHAR() FUNCTION S IN DYNAMIC SQL  CONCATINATION .

ASCII( ): Returns the ASCII code value of the leftmost character of a character expression.

       SYNTAX:  ASCII(char_expression)

EX:SELECT ASCII(32) ------------51



                                   PRINTING ALL ASCII VALUES FROM 0 TO 255


CREATE PROC USP_PRINT_ALL_ASCII_VALUES
AS
BEGIN
    DECLARE @I INT=1
    DECLARE @N INT=@I+255

WHILE(@I<=@N)
BEGIN
     PRINT  CHAR (@I)
     SET @I=@I+1
END
END

EXEC USP_PRINT_ALL_ASCII_VALUES

--------ASCII VALUES IN SELECT LIST

 CREATE PROC USP_PRINT_ALL_ASCII_VALUES
AS
BEGIN
            DECLARE @I INT=1
             DECLARE @N INT=@I+255
             SELECT @N
WHILE(@I<=@N)
BEGIN
             SELECT   CHAR (@I) AS ASCII_VALUE,ASCII(@I) AS ASCII_CODE-VALUE
             SET @I=@I+1
END
END


                                    PRINTING ASCII SMALL ALPHABETES 


 CREATE PROC USP_PRINT_SMALL_ALPHA_ASCII_VALUES
AS
BEGIN
              DECLARE @I INT=97
              DECLARE @N INT=@I+25

WHILE(@I<=@N)
BEGIN
            PRINT  CHAR (@I)
            SET @I=@I+1
END
END


                                       PRINTING ASCII CAPITAL LETTERS


 CREATE PROC USP_PRINT_CAPITAL_ASCII_VALUES
AS
BEGIN
           DECLARE @I INT=65
           DECLARE @N INT=@I+25

WHILE(@I<=@N)
BEGIN
          PRINT  CHAR (@I)
           SET @I=@I+1
END
END


                                          PRINTING ASCII NUMBERS 0-9


CREATE PROC USP_PRINT_NUM_ASCII_VALUES
AS
BEGIN
           DECLARE @I INT=48
           DECLARE @N INT=@I+9

WHILE(@I<=@N)
BEGIN
           PRINT  CHAR (@I)
           SET @I=@I+1
END
END


                                  PRINT SPECIAL CHAR 'S ASCII VALUES


 CREATE PROC USP_PRINT_ALL_ASCII_VALUES
AS
BEGIN
    DECLARE @I INT=32
    DECLARE @N INT=@I+32

WHILE(@I<=@N)
BEGIN
     PRINT  CHAR (@I)
     SET @I=@I+1
END
END


                     






       







No comments:

Post a Comment