function for TSQL : OEMtoANSI

  • Hello comunity

    Sometimes when i import data to populate some table , characters are not correct.

    I want to know if in TSQL when i make an update query i could use some a function for transforming character , like in VFP - OEMtoANSI

    i use a code page 1252 SQL Latin collation

    Many thanks

    Luis Santos

  • If you have some extended ASCII chars that have ended up in a table with the wrong conversion, you might have some luck with the COLLATION clause.

    However, this should really be adressed at the time of input, so that the 'wrong' conversion never happens.

    Depending on charachters, some conversions are destructive, so you can't reverse them after the fact.

    There used to be an INF: Understanding ANSI OEM doc on ms kb, but I can't find that atm.

    However, there's a lot of articles to be found on Google on the subject.

    /Kenneth

  • the first thing i would check is to see if you were using N(types) for all your data that is in the the table definitions, in any stored procedures and when passing text parameters.

    create table wide( x as nchar(10), y as nvarchar(1000))

    create procedure wide_insert

    @x nchar(10),

    @y nvarchar(1000)

    as

    insert into wide values( @x,@y)

    end

    exec wide_insert N'String1', N'Long String'

    most likely one or more of the variables isn't a wide char which is causing the problem

    Paul Ross

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply