<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: How to update\\insert data into a NVARCHAR column using ODBC API in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/how-to-update-insert-data-into-a-nvarchar-column-using-odbc-api/qaa-p/13848836#M4879679</link>
    <description>&lt;P&gt;Sorry... but... the second option "Use a host variable to specify the Unicode character values ('?')" is that the same as using a prepared execution?&lt;/P&gt;</description>
    <pubDate>Thu, 05 Feb 2015 19:50:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2015-02-05T19:50:04Z</dc:date>
    <item>
      <title>How to update\\insert data into a NVARCHAR column using ODBC API</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-update-insert-data-into-a-nvarchar-column-using-odbc-api/qaq-p/13848834</link>
      <description>&lt;P&gt;I am trying to update a Sybase table via Microsofts ODBC API. The following is the basics of the C++ I am trying to execute. In table, TableNameXXX, ColumnNameXXX has a type of  NVARCHAR( 200 ).&lt;/P&gt;
&lt;PRE class="codehilite"&gt;&lt;CODE&gt;    SQLWCHAR updateStatement[ 1024 ] = L"UPDATE TableNameXXX SET ColumnNameXXX = N'Executive Chair эюя' WHERE PKEYXXX = 'VALUE'";  
   if( ret = SQLExecDirect( hstmt, ( SQLWCHAR* ) updateStatement, SQL_NTS ) != SQL_SUCCESS )
   {
       // Handle Error
   }


&lt;P&gt;The Sybase database has a CatalogCollation of 1252LATIN1, CharSet of windows-1252,  Collation of 1252LATIN1, NcharCharSet of UTF-8 and an NcharCollation of UCA.&lt;/P&gt;
&lt;P&gt;Once this works for the Sybase ODBC connection I need to get it to work in various other ODBC drivers for other databases.&lt;/P&gt;
&lt;P&gt;I do not get any errors however - the data in the database is not the unicode I attempted to update.&lt;/P&gt;
&lt;P&gt;Does anyone know how to get this to work? What am I missing?&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Feb 2015 17:59:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-update-insert-data-into-a-nvarchar-column-using-odbc-api/qaq-p/13848834</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-02-05T17:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to update\\insert data into a NVARCHAR column using ODBC API</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-update-insert-data-into-a-nvarchar-column-using-odbc-api/qaa-p/13848835#M4879678</link>
      <description>&lt;P&gt;Hi David,&lt;/P&gt;
&lt;P&gt;SQL statements are always parsed in the character set of the database (so Windows-1252 in this case). If you wish to pass Unicode/NCHAR data, you need to do one of the following (from: &lt;A href="http://dcx.sap.com/index.html#sa160/en/dbadmin/natlang-s-5322854.html"&gt;http://dcx.sap.com/index.html#sa160/en/dbadmin/natlang-s-5322854.html&lt;/A&gt; )&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Use the &lt;A href="http://dcx.sap.com/index.html#sa160/en/dbreference/unistr-function.html"&gt;UNISTR&lt;/A&gt; function to specify the Unicode character values&lt;/LI&gt;
&lt;LI&gt;Use a host variable to specify the Unicode character values ('?')&lt;/LI&gt;
&lt;LI&gt;Use UTF-8 as the database character set&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;So for ODBC, you will want to use &lt;A href="https://msdn.microsoft.com/en-us/library/ms716365%28v=vs.85%29.aspx"&gt;prepared execution&lt;/A&gt; with SQLPrepare, SQLBindParameter, and SQLExecute.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Feb 2015 18:55:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-update-insert-data-into-a-nvarchar-column-using-odbc-api/qaa-p/13848835#M4879678</guid>
      <dc:creator>jeff_albion</dc:creator>
      <dc:date>2015-02-05T18:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to update\\insert data into a NVARCHAR column using ODBC API</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-update-insert-data-into-a-nvarchar-column-using-odbc-api/qaa-p/13848836#M4879679</link>
      <description>&lt;P&gt;Sorry... but... the second option "Use a host variable to specify the Unicode character values ('?')" is that the same as using a prepared execution?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Feb 2015 19:50:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-update-insert-data-into-a-nvarchar-column-using-odbc-api/qaa-p/13848836#M4879679</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-02-05T19:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to update\\insert data into a NVARCHAR column using ODBC API</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-update-insert-data-into-a-nvarchar-column-using-odbc-api/qaa-p/13848837#M4879680</link>
      <description>&lt;P&gt;Got it working with SELECT UNISTR...&lt;/P&gt;
&lt;P&gt;SQLWCHAR updateStatement[ 1024 ] = L"UPDATE TableNameXXX SET ColumnNameXXX = ( SELECT UNISTR( 'Executive Chair \\u044F\\u044D\\u044E\\u044F' ) ) WHERE PKEYXXX = 'VALUE'";&lt;/P&gt;
&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Feb 2015 22:22:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-update-insert-data-into-a-nvarchar-column-using-odbc-api/qaa-p/13848837#M4879680</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-02-05T22:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to update\\insert data into a NVARCHAR column using ODBC API</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-update-insert-data-into-a-nvarchar-column-using-odbc-api/qaa-p/13848838#M4879681</link>
      <description>&lt;P&gt;Yes - the second option is using a host variable and then binding it with data (a.k.a prepared execution).&lt;/P&gt;</description>
      <pubDate>Fri, 06 Feb 2015 10:21:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-update-insert-data-into-a-nvarchar-column-using-odbc-api/qaa-p/13848838#M4879681</guid>
      <dc:creator>jeff_albion</dc:creator>
      <dc:date>2015-02-06T10:21:55Z</dc:date>
    </item>
  </channel>
</rss>

