Problem with cyrillic characters in column caption

  • Hi,

    I have following snippet of code inside stored procedure:

    declare @sql nvarchar(max)

    set @sql = N'

    exec (''select p.ColumnA [CyrillicCaptionA], P.ColumnB

    [CyrillicCaptionB] from dbo.#someTable p'' )

    '

    The problem:

    When previous code is executed each cyrillic character in column caption is replaced by question mark. I have similar code inside another procedure and it works fine. How can I fix this problem ?

    Thanks

  • I have to admit that I have no idea why it works for you on one procedure and it doesn’t work on a second procedure, but I think that in any case this is something that shouldn’t be done in the database. The presentation layer can decide how it wants to present the data. It can modify the column’s name and can also use a different language as the columns’ name. The database is responsible for the data and has no role in the presentation layer. In short, the database shouldn’t be used to modify the columns’ name in different language. Instead the application should do it.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Adi Cohn-120898 (1/10/2011)


    I have to admit that I have no idea why it works for you on one procedure and it doesn’t work on a second procedure, but I think that in any case this is something that shouldn’t be done in the database. The presentation layer can decide how it wants to present the data. It can modify the column’s name and can also use a different language as the columns’ name. The database is responsible for the data and has no role in the presentation layer. In short, the database shouldn’t be used to modify the columns’ name in different language. Instead the application should do it.

    Adi

    In Asp.net Cyrillic is one of the languages that require database collation and application layer text encoding to avoid character conversion issues. So the user needs to either use column collation or in SQL Server 2008 DML level collation.

    Kind regards,
    Gift Peddie

  • In Asp.net Cyrillic is one of the languages that require database collation and application layer text encoding to avoid character conversion issues. So the user needs to either use column collation or in SQL Server 2008 DML level collation.

    I admit that I’m not a developer. It ‘s been a while since I worked as developer and I’ve never worked as ASP.Net developer, but it sounds strange to me that in order to write a label on the screen using Cyrillic language, you also have to use Cyrillic language for the data. AFAIK there is no connection between the column’s caption that is being shown in the application and the data (but then again, as I said I’m not an ASP.Net developer).

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Adi Cohn-120898 (1/10/2011)


    In Asp.net Cyrillic is one of the languages that require database collation and application layer text encoding to avoid character conversion issues. So the user needs to either use column collation or in SQL Server 2008 DML level collation.

    I admit that I’m not a developer. It ‘s been a while since I worked as developer and I’ve never worked as ASP.Net developer, but it sounds strange to me that in order to write a label on the screen using Cyrillic language, you also have to use Cyrillic language for the data. AFAIK there is no connection between the column’s caption that is being shown in the application and the data (but then again, as I said I’m not an ASP.Net developer).

    Adi

    What you are saying is related to static data but most Asp.net applications including SQL Server Central takes user input which must be persisted in SQL Server, what I am saying is usually data is two way so it is best to use both encoding in the application layer and collation in the database layer. If you don't Cyrillic is one of the European languages that can create character conversion issues as described by the user.

    Kind regards,
    Gift Peddie

Viewing 5 posts - 1 through 4 (of 4 total)

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