Special Characters in SQL Servers

  • Haris Masood

    SSC Veteran

    Points: 241

    On some server I execute a script in which I use a special Character '§' .So If execute the script through QUERY ANALYSER it is replaced by another one. But If Copy the Script through Enterprise Manager.It works fine

     

    Please tell me the method to overcome this problem through my script coz I am not allowed to change server settings.

     

    Thanx

  • MVDBA (Mike Vessey)

    SSC-Insane

    Points: 21757

    i generally use the following format

    declare @strsql navarchar(2000)

    set @strsql=' select abc,def,ghi,'''+chr(99)+''' from mytable

    exec (@strsql)

    i con't remember if its chr or char as i'm away from my BOL at the moment, but it seems to work nicely in all applications

    MVDBA

  • Haris Masood

    SSC Veteran

    Points: 241

    The problem is that when I execute the following script in SQL Query Analyser

     

    set @NewLetterText = replace(@NewLetterText,'<SPAN id=§' + cast(@mLetterFieldID as varchar) + '§ hideFocus contentEditable=false unselectable=''ON'' ATOMICSELECTION=''true''>','')

     

    It replace the ''§'' into "%" . But If i Copy the code into SQL enterprise manager it works fine.

     

     

    I want to know is there any statement in SQL like we set NO Count On or ANSI Null .

        

  • mosaic-287947

    Ten Centuries

    Points: 1045

    If you are formatting HTML, try using § instead of §. See http://www.fileformat.info/info/unicode/char/00a7/index.htm

    Also, check out BOL topic "Generate SQL Script", about saving a Query Analyzer script as unicode

    hth

     

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

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