Home Forums SQL Server 2005 Development Writing strings with chars 128-160 to an varchar column RE: Writing strings with chars 128-160 to an varchar column

  • You shouldn't have a problem with using varchar and CHAR for the characters you are talking about... see the following...

    Running this code...

    DECLARE @i int

    DECLARE @STR varchar(222)

    SET @i = 33 /*Start at 33 to skip SPACE and non-printable characters */

    SET @STR = ''

    WHILE (SELECT @i) < 256

    BEGIN

    SET @STR = @STR + CHAR(@i)

    SET @i = @i + 1

    END

    PRINT @STR

    Returns the following...

    !"#$%&'()*+,-./0123456789:; ?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ