Inserting data into a column with different colation

  • Hi,

    I have a table where the columns are set to Polish collation (in order to store Polish characters such as ą ć ę ł ń ó ś ź ż).

    I have a 2nd table where the columns are set to the server default collation (SQL_Latin1_General_CP1_CI_AS).

    The table definitions are exactly the same. All columns are set to char (rather than nchar).

    When I insert into table2 select * from table 1, I notice that the Polish characters are 'translated' into standard english characters.

    e.g 'ą' becomes 'a', 'ć' becomes 'c' etc.

    This is good as my application isn't configured to handle unicode characters.

    I'm just wondering exactly what is happening during the insert? Is SQL Server looking up the equivalent for these characters in the standard codepage?

    Can I rely on this behaviour to be consistent every time?

    thanks for any info.

    Phil.

  • make sure all your columns are NVARCHAR, and not VARCHAR....that should resolve the conversion issue, i think.

    collation only decides how the strigns are sorted and ordered by...it does not decide what strings can or cannot be saved.

    here's a sample of what you are doing...high ascii needs nvarchar:

    DECLARE @myString varchar(30)

    SET @myString = N'ac'

    select @myString --returns 'ac'!

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

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