用SQL查看字符串ASCII码

DECLARE @position int, @nstring nchar(12)
SET @position = 1
SET @nstring = N'字符串' PRINT 'Character #' + ' ' +
       'Unicode Character' + ' ' + 'UNICODE Value' WHILE @position <= DATALENGTH(@nstring)
       BEGIN
          SELECT @position, CONVERT(char(17), SUBSTRING(@nstring, @position, 1)),
              UNICODE(SUBSTRING(@nstring, @position, 1))
                  SELECT @position = @position + 1 END
posted @ 2008-05-29 18:06  maoyu417  阅读(1277)  评论(0编辑  收藏  举报