1: -- ---------------------------------------------------------------------
   2: -- displays ASCII characters, and identify which ones are printable
   3: -- ---------------------------------------------------------------------
   4: DECLARE @min int, @max int
   5: DECLARE @chars TABLE
   6: ( 
   7:     ASCIIValue       int,
   8:     ASCIIString      nvarchar(3),
   9:     IsPrintable      bit 
  10: )
  11: SET @min = 0
  12: SET @max = 300
  13:  
  14: -- Codes 33 to 126 are printable characters
  15: -- http://en.wikipedia.org/wiki/ASCII
  16: WHILE @min <= @max
  17: BEGIN
  18:     INSERT INTO @chars
  19:     SELECT 
  20:         @min, 
  21:         CHAR(@min),
  22:         CASE 
  23:             WHEN @min BETWEEN 33 AND 126 THEN 1
  24:             ELSE 0
  25:         END
  26:     SET @min = @min+1
  27: END
  28:  
  29: SELECT 
  30:     * 
  31: FROM 
  32:     @chars
  33: WHERE 
  34:     ASCIIString IS NOT NULL
  35:  
  36:  
  37:  

VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
List all ASCII characters, 10.0 out of 10 based on 1 rating  
Be Sociable, Share!
  • Tweet