inserting UCS-2 data into an nvarchar

  • I am having trouble inserting the simplest UCS-2 characters into an nvarchar. I think the issue has to do with NUL bytes. For example, the UCS-2 representation of the letter a is 0x0041 0x0000 in hex or 65 0 in decimal. SQL Server keeps on complaining that the string ends right where i have my nul byte. Any suggestions?

  • SQL Server actually uses UCS-2 so something else must be truncating your data and it could be better to use the exact language collation because in Europe SQL Server defines a different code page per language.  Try the link below for details and post again if you still have questions.  Hope this helps.

    http://support.microsoft.com/kb/q232580/

    http://blogs.msdn.com/sqlprogrammability/archive/2006/07/07/659375.aspx

    Kind regards,
    Gift Peddie

  • Which way are you trying to insert UCS-2 into nvarchar?

    Can you provide any sample of your script?

    _____________
    Code for TallyGenerator

  • It's a PHP script. I use the ICONV() function to convert my ASCII data into UCS-2LE. The conversion works perfectly. I try to execute the query but I get a syntax error. I get no syntax error when I use plain ASCII.

  • Which query are you trying to execute?

    What is the error message?

    What kind of data and which way you supply to that query?

    _____________
    Code for TallyGenerator

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

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