Problem nvarchar

Hi,
I wrote a basic c++ application to retrieve a nvarchar(120) field from an oracle database using ODBC.
char SQL[2056] = "select name from USERS";
char names[20][1024];
long rowSize = 20;
long len = SQL_NTS;
SQLUINTEGER NumRowsFetched;
SQLUSMALLINT RowStatusArray[20];
SQLINTEGER lenArray1[20];
retcode = SQLAllocHandle(SQL_HANDLE_STMT, hDBC, &hStmt);
SQLSetStmtAttr(hStmt, SQL_ATTR_ROW_BIND_TYPE, SQL_BIND_BY_COLUMN, 0);
SQLSetStmtAttr(hStmt, SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER)rowSize, 0);
SQLSetStmtAttr(hStmt, SQL_ATTR_ROW_STATUS_PTR, RowStatusArray, 0);
SQLSetStmtAttr(hStmt, SQL_ATTR_ROWS_FETCHED_PTR, &NumRowsFetched, 0);
retcode = SQLBindCol(hStmt, 1, SQL_C_CHAR, names, sizeof(names[0]), lenArray1);
// Execute SQL statement
retcode = SQLExecDirect(hStmt, (unsigned char*)SQL, SQL_NTS);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
while ((retcode = SQLFetchScroll(hStmt,SQL_FETCH_NEXT,0)) != SQL_NO_DATA)
for (int i = 0; i < NumRowsFetched; i++)
if ((RowStatusArray[i] == SQL_ROW_SUCCESS) ||
(RowStatusArray[i] == SQL_ROW_SUCCESS_WITH_INFO))
printf("name is %s", names);
Now this works on 10g, and prints out the names, but when I use 8i it
just prints blanks (no error - just no name!).
Is this something to do with the ODBC drivers?
Any help would be appreciated.
Thanks

Dev-
Thanks for replying. And that's funny, I think you were posting your comment right as I was posting my quick additional detail one.
Yes, I have actually already tried that. I have set the LKM to keep temporary tables so that I could check the C$_... table. And the nvarchar columns are already showing as null there. And there are no joins in this Interface at all. It is a very simple interface that mirrors a single small source table, into a clone on the Oracle side for staging purposes ( A [MSSQL] ---> B [Oracle] ).
So, because the C$_ is already showing nulls for the columns that were nvarchar, it seems something is happening in transit while converting the nvarchar to varchar2.
Thanks
John

Similar Messages

  • MS SQL to Oracle Problem:  nvarchar's being loaded as null varchar2's

    If anyone has any insight into this, I would really appreciate it.
    I'm trying to build an incredibly simple Interface that mirrors a small MS SQL Server table into and Oracle table. The source MS table is a series of int, smallint, numeric, datetime and nvarchar columns. Similiarly, I've built my Oracle target table to be comprised of corresponding number, date and varchar2 columns.
    The issue is that my Interface runs just fine, but only the date and number-related columns actually come across. All the columns that are loading nvarchar->varchar2 are simply populated with nulls.
    I can't seem to figure out what the problem that ODI is having. There are no errors during execution, and back in Designer I can even do a "View Data" on the source MS table, and can browser all the data just fine.
    Something is happening during transit and I can't figure out why. My current LKM is "LKM SQL to Oracle" though I've also tried "LKM SQL to SQL" with no luck. Clearly something is happening with the nvarchar to varchar2 conversion, but that seems like a ridiculous thing for ODI to have a problem with. Even moreso that's it not actually throwing any errors, but simply not populating them.
    Anyone have any thoughts?
    Thanks
    John

    Dev-
    Thanks for replying. And that's funny, I think you were posting your comment right as I was posting my quick additional detail one.
    Yes, I have actually already tried that. I have set the LKM to keep temporary tables so that I could check the C$_... table. And the nvarchar columns are already showing as null there. And there are no joins in this Interface at all. It is a very simple interface that mirrors a single small source table, into a clone on the Oracle side for staging purposes ( A [MSSQL] ---> B [Oracle] ).
    So, because the C$_ is already showing nulls for the columns that were nvarchar, it seems something is happening in transit while converting the nvarchar to varchar2.
    Thanks
    John

  • Problem with several stored values in nvarchar!

    Hi everyone,
    One friend asked me to help him about a query which needs to join some three tables. There is an nvarchar valued column in the main table that contains several id's need to be joined to another table. For example the value is that '18,20,1,26'. I've found
    a query on a simple nvarchar that seperates id's which is on stackoverflow. but when querying there is surely more nvarchar's.
    My problem is at that point and I got puzzled: when querying there are much more results rather than single nvarchar. How can I query it?

    Some misunderstandings occurred. I want to clear some aspects. That db is a university db. By the time db firstly released, it wasn't thought some problems could happen. That is one of them. I found that query from a site which I mentioned before.
    Declare @products varchar(200) = '1|20|3|343|44|6|8765'
    Declare @individual varchar(20) = null
    WHILE LEN(@products) > 0
    BEGIN
    IF PATINDEX('%|%',@products) > 0
    BEGIN
    SET @individual = SUBSTRING(@products, 0, PATINDEX('%|%',@products))
    SELECT @individual
    SET @products = SUBSTRING(@products, LEN(@individual + '|') + 1,
    LEN(@products))
    END
    ELSE
    BEGIN
    SET @individual = @products
    SET @products = NULL
    SELECT @individual
    END
    END
    It can divide the int's in the varchar variable @products.But when querying the real data form db how it can be done? There are some additionals:
    we have four tables which are related to each other. In one table there is an nvarchar valued comma seperated data for example '1,15,25,89' which are the id column of another table. But as you can see we need to seperate them  while query is running and
    join those values to that "another table". My friend sent me a sample query which gives the following result.
    Msg 245, Level 16, State 1, Line 1Conversion failed when converting the nvarchar value '1,2,10,11,12,13,14,15' to data type int.

  • [Execute SQL Task] Error: Executing the query "DECLARE_@XMLA nvarchar(3000) ,__@DateSerial nvarch..." failed with the following error: "Incorrect syntax near '-'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly,

    Hi
    DECLARE @XMLA nvarchar(3000)
    , @DateSerial nvarchar(35);
    -- Change date to format YYYYMMDDHHMMSS
    SET @DateSerial = CAST(GETDATE() AS DATE);
    --SELECT @DateSerial
    Set @XMLA = 
    N' <Batch xmlns="http://schemas.microsoft.com/analysis services/2003/engine">
     <ErrorConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2"
    xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200"
    xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200">
    <KeyErrorLimit>-1</KeyErrorLimit>
    <KeyNotFound>IgnoreError</KeyNotFound>
    <NullKeyNotAllowed>IgnoreError</NullKeyNotAllowed>
     </ErrorConfiguration>
     <Parallel>
    <Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2"
    xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200"
    xmlns:ddl300="http://schemas.microsoft.com/analysisservices/2011/engine/300" xmlns:ddl300_300="http://schemas.microsoft.com/analysisservices/2011/engine/300/300">
     <Object>
     <DatabaseID>MultidimensionalProject5</DatabaseID>
     <CubeID>giri</CubeID>
     <MeasureGroupID>Fact Internet Sales</MeasureGroupID>
     </Object>
     <Type>ProcessFull</Type>
     <WriteBackTableCreation>UseExisting</WriteBackTableCreation>
     </Process>
      </Parallel>
    </Batch>';
    EXEC (@XMLA) At SHALL-PCAdventureWorksDw ;
     iam executive the    query when iam getting below error.
      [Execute SQL Task] Error: Executing the query "DECLARE
    @XMLA nvarchar(3000)
    , @DateSerial nvarch..." failed with the following error: "Incorrect syntax near '-'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set
    correctly, or connection not established correctly. 
     how to solve this error;
     please help me

    What are you trying to do? What sort of data source is  SHALL-PCAdventureWorksDw?
    When you use EXEC() AT, I would execpt to see an SQL string to be passed to EXEC(), but you are passing an XML string????
    If you explain why you think this would work in the first place, maybe we can help you.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Nvarchar problem

    hi every body,
    i made a connection to sql server 2008 from oracle using Heterogeneous Connectivity , all the columns in sql server table is of type nvarchar(15) .When i made select like following : select * from xxx@sqlserver
    i have result but for each column the first character is appeare and the rest not appeare ??? (maher in sql server after select m from oracle)
    regards
    maher

    Hi,
    Please let me know the platform where your Database Gateway for ODBC is installed, the ODBC driver you use (provider, version...)...
    If you're on Unix/Linux platform, please send the content of your ODBC.INI file
    I remember similar problem with Easysoft driver.....
    Thanks.
    Regards
    Mireille

  • Problems with SQL server 2008 nvarchar type to varchar in oracle.

    Hello    
    I did an Heterogeneous Connectivity between SQL server 2008 db and Oracle 11g, so far so good, but when i try to view colum data on RPD (only varchar type) i only see the first character of the string.
    One more thing, when i try to see the data on Oracle SQL developer i get some strange characters, like when we have the wrong character encoding on our browser.
    Some print to illustrate the problem.
    Oracle SQL developer query:
    http://postimg.org/image/5cvyqw6ih/
    Microsoft SQL developer query :
    http://postimg.org/image/skddx991f/
    RPD printscreen :
    http://postimg.org/image/aok2337cp/
    SQLplus  (as you can see the are spaces between the characters ) :
    http://postimg.org/image/664xw1xjh/
    To finish the data will be use to build an mobile app with oracle mobile app designer.
    Thank you

    The spaces you see between the characters when using the gateway indicate a wrong charset is being used.
    1. Which gateway are you using - DG4MSQL or Dg4ODBC?
    2. Could you please post the gateway init file and just in case it is DG4ODBC also the odbc.ini file
    3. What's the character set of the Oracle database?
    4. Looks like you're connected using Putty to a Unix box - what is the Putty NLS setting?
    5. What is the NLS setting when starting SQL*Plus and what is the LOCALE setting?
    6. Was a NLS_LANG parameter set when the gateway was started? Please change in your gateway init file the HS_FDS_TRACE_LEVEL to DEBUG, then run again the query and post it to a share.
    => There's a note that guides you step by step to configure the gateway and your env correctly - please have a look at:
    NLS Guide for Generic Connectivity and Gateways (Doc ID 230239.1)
    - Klaus

  • A problem about nvarchar type

    Hello all,
    I have a field which type is nvarchar (100). When I insert English characters to this column, it works whell. But when I insert Chinese, the limitation is more less than 100. Who can tell me why?
    Thanks a lot!

    The limitation value of 100 actually means 100 bytes. With 'normal' characters, such as ASCII english, this translates into 100 characters.
    However, chinese characters usually take up more than a single byte each (unicode), so your character limit value will probably be half (50), perhaps even less...

  • MS SQL Server 2000 - Oracle 8.1.7 nvarchar problem.

    Hello all,
    I move my database from MS SQL server 2000 to the Oracle 8.1.7 (W2K platform) and note, that Oracle Migration Workbench (ver 9.2.0.1.2 build 20020910) create wrong SQL Server model. In my SQL Server table I have one column with nvarchar type with length equal 3000 (for example) , but Oracle Migration Workbench create corresponded table in SQL server model with nvarchar type BUT with length equal 6000. I note that it multiply the length of nvarchar and nchar types by 2 and as a result in Oracle model that column has a CLOB type.
    Is anyone has any ideas how to fix it?
    Best regards,
    Victor Conovalov

    Hi Victor,
    this is a bug in the OMWB - bug 2632100. Can I suggest that you use the OMWB to migrate the database schema only to Oracle (i.e in step 3 of the Migration Wizard, choose 'No' when asked 'Do you want to migrate the table data to Oracle'). Your database schema should migrate as uaual. Then use Enterprise Manager to change the offending column types from 'CLOB' back to 'NVARCHAR' and also half the length.
    Alternatively, you can generate the generate migration scripts from the OMWB Oracle Model (details in the reference guide and user guide) and edit the scripts so that you can change the offending column types from 'CLOB' back to 'NVARCHAR' and half the length. These scripts can then be used to generate the schema and stored programs in the Oracle Database.
    You can then use the OMWB to generate SQL*Loader scripts (more details in the reference guide and users guide) so that you can move the data to your Oracle database.
    I will keep the bug updated with any news of a fix.
    I hope this helps,
    Tom.

  • Problems with explain plan and statement

    Hi community,
    I have migrated a j2ee application from DB2 to Oracle.
    First some facts of our application and database instance:
    We are using oracle version 10.2.0.3 and driver version 10.2.0.3. It runs with charset Unicode 3.0 UTF-8.
    Our application is using Tomcat as web container and jboss as application server. We are only using prepared statements. So if I talk about statements I always mean prepared statements. Also our application is setting the defaultNChar property to true because every char and varchar field has been created as an nchar and nvarchar.
    We have some jsp sites that contains lists with search forms. Everytime I enter a value to the form that returns a filled resultset, the lists are performing great. But everytime I enter a value that returns an empty resultset, the lists are 100 times slower. The jsp sites are running in the tomcat environment and submitting their statements directly to the database. The connections are pooled by dbcp. So what can cause this behaviour??
    To anaylze this problem I started logging all statements and filled-in search field values and combinations that are executed by the lists described above. I also developed a standalone helper tool that reads the logged statements, executes them to the database and generates an explain plan for every statement. But now there appears a strange situation. Every statement, that performs really fast within our application, is now executed by the helper tool extremely slow. So I edited some jsp pages within our application to force an explain plan from there (tomcat env). So when I'm executing the same statement I'm getting with the exactly same code two completely different explain plans.
    First the statement itself:
    select LINVIN.BBASE , INVINNUM , INVINNUMALT , LINVIN.LSUPPLIERNUM , LSUPPLIERNUMEXT , LINVIN.COMPANYCODE , ACCOUNT , INVINTXT , INVINSTS , INVINTYP , INVINDAT , RECEIPTDAT , POSTED , POSTINGDATE , CHECKCOSTCENTER , WORKFLOWIDEXT , INVINREFERENCE , RESPONSIBLEPERS , INVINSUM_V , INVINSUMGROSS_V , VOUCHERNUM , HASPOSITIONS , PROCESSINSTANCEID , FCURISO_V , LSUPPLIER.AADDRLINE1 from LINVIN, LSUPPLIER where LINVIN.BBASE = LSUPPLIER.BBASE and LINVIN.LSUPPLIERNUM = LSUPPLIER.LSUPPLIERNUM and LINVIN.BBASE = ? order by LINVIN.BBASE, INVINDAT DESC
    Now the explain plan from our application:
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 101 | 28583 | 55 (0)| 00:00:01 |
    | 1 | NESTED LOOPS | | 101 | 28583 | 55 (0)| 00:00:01 |
    | 2 | TABLE ACCESS BY INDEX ROWID| LINVIN | 93709 | 12M| 25 (0)| 00:00:01 |
    |* 3 | INDEX RANGE SCAN | LINV_INVDAT | 101 | | 1 (0)| 00:00:01 |
    | 4 | TABLE ACCESS BY INDEX ROWID| LSUPPLIER | 1 | 148 | 1 (0)| 00:00:01 |
    |* 5 | INDEX UNIQUE SCAN | PK_177597 | 1 | | 1 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    3 - access("LINVIN"."BBASE"=:1)
    filter("LINVIN"."BBASE"=:1)
    5 - access("LSUPPLIER"."BBASE"=:1 AND "LINVIN"."LSUPPLIERNUM"="LSUPPLIER"."LSUPPLIERNUM")
    Now the one from the standalone tool:
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 93773 | 25M| | 12898 (1)| 00:02:35 |
    | 1 | SORT ORDER BY | | 93773 | 25M| 61M| 12898 (1)| 00:02:35 |
    |* 2 | HASH JOIN | | 93773 | 25M| 2592K| 7185 (1)| 00:01:27 |
    | 3 | TABLE ACCESS BY INDEX ROWID| LSUPPLIER | 16540 | 2390K| | 332 (0)| 00:00:04 |
    |* 4 | INDEX RANGE SCAN | LSUPPLIER_HAS_BASE_FK | 16540 | | | 11 (0)| 00:00:01 |
    | 5 | TABLE ACCESS BY INDEX ROWID| LINVIN | 93709 | 12M| | 6073 (1)| 00:01:13 |
    |* 6 | INDEX RANGE SCAN | LINVOICE_BMDT_FK | 93709 | | | 84 (2)| 00:00:02 |
    Predicate Information (identified by operation id):
    2 - access("LINVIN"."BBASE"="LSUPPLIER"."BBASE" AND "LINVIN"."LSUPPLIERNUM"="LSUPPLIER"."LSUPPLIERNUM")
    4 - access("LSUPPLIER"."BBASE"=:1)
    6 - access("LINVIN"."BBASE"=:1)
    The size of the tables are: LINVIN - 383.692 Rows, LSUPPLIER - 115.782 Rows
    As you can see the one executed from our application is much faster than the one from the helper tool. So why picks oracle a completely different explain plan for the same statement? An why is a hash join much slower than a nested loop? Because If I'm right a nested loop should only be used when the tables are pretty small..
    I also tried to play with some parameters:
    I set optimizer_index_caching to 100 and optimizer_index_cost_adj to 30. I also changed optimizer_mode to FIRST_ROWS_100.
    I would really appreciated, if somebody can help me with this issue, because I'm really getting more and more distressed...
    Thanks in advance,
    Tobias
    Edited by: tobiwan on Sep 3, 2008 11:49 PM
    Edited by: tobiwan on Sep 3, 2008 11:50 PM
    Edited by: tobiwan on Sep 4, 2008 12:01 AM
    Edited by: tobiwan on Sep 4, 2008 12:02 AM
    Edited by: tobiwan on Sep 4, 2008 12:04 AM
    Edited by: tobiwan on Sep 4, 2008 12:06 AM
    Edited by: tobiwan on Sep 4, 2008 12:06 AM
    Edited by: tobiwan on Sep 4, 2008 12:07 AM

    tobiwan wrote:
    Hi again,
    Here ist the answer:
    The problem, because I got two different explain plans, was that the external tool uses the NLS sesssion parameters coming from the OS which are in my case "de/DE".
    Within our application these parameters are changed to "en/US"!! So if I'm calling in my external tool the java function Locale.setDefault(new Locale("en","US")) before connecting to the database the explain plans are finally equal.That might explain why you got two different execution plan, because one plan was obviously able to avoid a SORT ORDER BY operation, whereas the second plan required to run SORT ORDER BY operation, obviously because of the different NLS_SORT settings. An index by default uses the NLS_SORT = 'binary' order whereas ORDER BY obeys the NLS_SORT setting, which probably was set to 'GERMAN' in your "external tool" case. You can check the "NLS_SESSION_PARAMETERS" view to check your current NLS_SORT setting.
    For more information regarding this issue, see my blog note I've written about this some time ago:
    http://oracle-randolf.blogspot.com/2008/09/getting-first-rows-of-large-sorted.html
    Now let me make a guess why you observe the behaviour that it takes so long if your result set is empty:
    The plan avoiding the SORT ORDER BY is able to return the first rows of the result set very quickly, but could take quite a while until all rows are processed, since it requires potentially a lot of iterations of the loop until everything has been processed. Your front end probably by default only display the first n rows of the result set and therefore works fine with this execution plan.
    Now if the result set is empty, depending on your data, indexes and search criteria, Oracle has to work through all the data using the inefficient NESTED LOOP approach only to find out that no data has been found, and since your application attempts to fetch the first n records, but no records will be found, it has to wait until all data has been processed.
    You can try to reproduce this by deliberately fetching all records of a query that returns data and that uses the NESTED LOOP approach... It probably takes as long as in the case when no records are found.
    Note that you seem to use bind variables and 10g, therefore you might be interested that due to the "bind variable peeking" functionality you might potentially end up with "unstable" plans depending on the values "peeked" when the statement is parsed.
    For more information, see this comprehensive description of the issue:
    http://www.pythian.com/blogs/867/stabilize-oracle-10gs-bind-peeking-behaviour-by-cutting-histograms
    Note that this changes in 11g with the introduction of the "Adaptive Cursor Sharing".
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Problem with Arabic characters

    Hi:
    I don't know if this is the correct place to post the question, but here it goes...
    I have an SQL 2005 database, connected via a Linked Server to an Oracle Database.
    I have a table in SQL that contains arabic characters, and I need to insert it into an Oracle table.
    These characters appear as "????" after being inserted in the oracle table.
    I guess I hace some collation/characterset problem, but cannot finf the solution.
    The column where the arabic characyers are saved in SQL is defined as:
         [Remarks] [nvarchar](1000) NULL,
    And default SQL server collation is: SQL_Latin1_General_CP1_CI_AS
    When I do a select on this table, it can see arabic correctly.
    ORACLE NLS CONFIGURATION IS:
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CHARACTERSET AR8MSWIN1256
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY $
    NLS_COMP BINARY
    NLS_LENGTH_SEMANTICS BYTE
    NLS_NCHAR_CONV_EXCP FALSE
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_RDBMS_VERSION 11.1.0.6.0
    The sql sentence in SQL server that moves the data to oracle is:
    INSERT INTO openquery(Oracle_DB, 'select Ticket_NO,Remarks from webportal.webcc_escal_det')
         (Ticket_NO,Remarks )
         SELECT Ticket_NO, Remarks
         FROM Details(nolock)
    Thanks in advance!!
    Mariana

    I think first you should check your character set
    SELECT * FROM NLS_DATABASE_PARAMETERS where parameter = 'NLS_CHARACTERSET'
    For oracle to display correctly, you need to change your character set that caters to Arabic

  • Query Active Directory + Problem with thumbnailPhoto

    Hi<o:p></o:p>
    I have a problem and I don’t know if it is my SQL Query, so here goes
    <o:p></o:p>
    I have a view on my SQL server that Queries our Active Directory. I can see that there is data in the table.<o:p></o:p>
    But when I try to use the Image in some C# code I get an error on 60% of the images with the exception header missing or corrupted.
    My view is built with this Query:
    select
    * from
    openquery
    ADSI,'SELECT sAMAccountName, mail, title, displayName, telephoneNumber, mobile, sn, givenName,  department, thumbnailPhoto
    FROM ''LDAP:[REMOVED]''
    WHERE objectCategory = ''Person''
    Do you have any idea where the problem is? The photos shows up fine in Outlook, SharePoint, lync etc. I’m pretty sure that the C# code works correctly. Hope you can help.
    Regards
    If only I had time to learn everything I wanted ...

    Hi Latheesh
    I've tried with this script:
    SELECT ISNULL(ROW_NUMBER() OVER ( ORDER BY department ), -999) 'id' ,
    CONVERT(NVARCHAR(25), givenName) AS Fornavn ,
    CONVERT (NVARCHAR(50), sn) AS Efternavn ,
    CONVERT(CHAR(5), UPPER(SUBSTRING(mail, CHARINDEX(mail, N'@'),
    CHARINDEX(N'@', mail)))) AS 'initialer' ,
    CONVERT(NVARCHAR(255), mail) AS Mail ,
    CONVERT(NVARCHAR(75), title) AS Stilling ,
    CONVERT(NVARCHAR(120), department) AS Afdeling ,
    CONVERT(NVARCHAR(13), telephoneNumber) AS Fastnet ,
    CONVERT(NVARCHAR(13), mobile) AS Mobil ,
    CASE WHEN userAccountControl = 2 THEN 'Account is Disabled'
    WHEN userAccountControl = 16 THEN 'Account Locked Out'
    WHEN userAccountControl = 17
    THEN CONVERT (VARCHAR(48), 'Entered Bad Password')
    WHEN userAccountControl = 32
    THEN CONVERT (VARCHAR(48), 'No Password is Required')
    WHEN userAccountControl = 64
    THEN CONVERT (VARCHAR(48), 'Password CANNOT Change')
    WHEN userAccountControl = 512 THEN 'Normal'
    WHEN userAccountControl = 514 THEN 'Disabled Account'
    WHEN userAccountControl = 544
    THEN 'Account Enabled - Require user to change password at first logon'
    WHEN userAccountControl = 8192
    THEN 'Server Trusted Account for Delegation'
    WHEN userAccountControl = 524288
    THEN 'Trusted Account for Delegation'
    WHEN userAccountControl = 590336
    THEN 'Enabled, User Cannot Change Password, Password Never Expires'
    WHEN userAccountControl = 65536
    THEN CONVERT (VARCHAR(48), 'Account will Never Expire')
    WHEN userAccountControl = 66048
    THEN 'Enabled and Does NOT expire Paswword'
    WHEN userAccountControl = 66050
    THEN 'Normal Account, Password will not expire and Currently Disabled'
    WHEN userAccountControl = 66064
    THEN 'Account Enabled, Password does not expire, currently Locked out'
    WHEN userAccountControl = 8388608
    THEN CONVERT (VARCHAR(48), 'Password has Expired')
    ELSE CONVERT (VARCHAR(248), userAccountControl)
    END AS 'Disabled' ,
    CONVERT(NVARCHAR(75), givenName + ' ' + sn) AS 'DisplayName' ,
    CONVERT (VARBINARY(MAX), thumbnailPhoto) AS 'Photo'
    INTO ##adTemptable
    FROM openquery
    ADSI,'SELECT sAMAccountName, mail, title, displayName, telephoneNumber, mobile, sn, givenName, department, thumbnailPhoto,userAccountControl
    FROM ''[REMOVED]''
    WHERE objectCategory = ''Person''
    WHERE department IS NOT NULL
    But i still gets the same error on MANY rows
    OLE DB provider 'ADsDSOObject' for linked server 'ADSI' returned truncated data for column '[ADsDSOObject].thumbnailPhoto'. The actual data length is 6846 and truncated data length is 4000.
    OLE DB provider 'ADsDSOObject' for linked server 'ADSI' returned truncated data for column '[ADsDSOObject].thumbnailPhoto'. The actual data length is 7006 and truncated data length is 4000.
    OLE DB provider 'ADsDSOObject' for linked server 'ADSI' returned truncated data for column '[ADsDSOObject].thumbnailPhoto'. The actual data length is 6496 and truncated data length is 4000.
    If only I had time to learn everything I wanted ...

  • Key mapping problem in Intercompany Integration Solution for SBO

    Hello
    I am installing  Intercompany integration solution 2.0 for SAP Business One  in SBO 9.0 PL12. I installed Integration framewerk, have the several DB in the SLD, with test succesfull. I registered the addon in the databases, Installed the Intercompany integration solution scenarios. Everything ok. I also configured settings in SAP Business One with the Intercompany Initialization Wizard in all companys
    I have the next problem. When doing key mapping, i try to continue mapping PaymentTerms but i click the button with ... dots and try to choose an option, it appears blanck, cannot select any optiion from the other database. I mark the button i prese and see the seleccioction window empty
    When i try to Download Key Mapping Excel Template Data and select PaymentTerms, It saves a file with the next error (it has not a csv structure)
    245 - Conversion failed when converting the nvarchar value '10 DIAS : 10' to data type int. - S0001 -
    Any suggestions ?
    Regars
    Héctor

    Hi Hector,
    Please ensure that in your Payment Terms code, no such special character has been used that are reserved by XML.This may cause conflict with the XML format and may lead to this issue.
    Moreover, for analysis, you may provide with the list of common Payment Terms across your Intercompany participating companies.
    Regards,
    Agneesh Jain
    SAP Intercompany Team

  • (new?) performance problem using jDriver after a Sql Server 6.5 to 2000 conversion

    Hi,
    This is similar - yet different - to a few of the old postings about performance
    problems with using jdbc drivers against Sql Server 7 & 2000.
    Here's the situation:
    I am running a standalone java application on a Solaris box using BEA's jdbc driver
    to connect to a Sql Server database on another network. The application retrieves
    data from the database through joins on several tables for approximately 40,000
    unique ids. It then processes all of this data and produces a file. We tuned
    the app so that the execution time for a single run through the application was
    24 minutes running against Sql Server 6.5 with BEA's jdbc driver. After performing
    a DBMS conversion to upgrade it to Sql Server 2000 I switched the jDriver to the
    Sql Server 2000 version. I ran the app and got an alarming execution time of
    5hrs 32 min. After some research, I found the problem with unicode and nvarchar/varchar
    and set the "useVarChars" property to "true" on the driver. The execution time
    for a single run through the application is now 56 minutes.
    56 minutes compared to 5 1/2 hrs is an amazing improvement. However, it is still
    over twice the execution time that I was seeing against the 6.5 database. Theoretically,
    I should be able to switch out my jdbc driver and the DBMS conversion should be
    invisible to my application. That would also mean that I should be seeing the
    same execution times with both versions of the DBMS. Has anybody else seen a
    simlar situation? Are there any other settings or fixes that I can put into place
    to get my performance back down to what I was seeing with 6.5? I would rather
    not have to go through and perform another round of performance tuning after having
    already done this when the app was originally built.
    thanks,
    mike

    Mike wrote:
    Joe,
    This was actually my next step. I replaced the BEA driver with
    the MS driver and let it run through with out making any
    configuration changes, just to see what happened. I got an
    execution time of about 7 1/2 hrs (which was shocking). So,
    (comparing apples to apples) while leaving the default unicode
    property on, BEA ran faster than MS, 5 1/2 hrs to 7 1/2 hrs.
    I then set the 'SendStringParametersAsUnicode' to 'false' on the
    MS driver and ran another test. This time the application
    executed in just over 24 minutes. The actual runtime was 24 min
    16 sec, which is still ever so slightly above the actual runtime
    against SS 6.5 which was 23 min 35 sec, but is twice as fast as the
    56 minutes that BEA's driver was giving me.
    I think that this is very interesting. I checked to make sure that
    there were no outside factors that may have been influencing the
    runtimes in either case, and there were none. Just to make sure,
    I ran each driver again and got the same results. It sounds like
    there are no known issues regarding this?
    We have people looking into things on the DBMS side and I'm still
    looking into things on my end, but so far none of us have found
    anything. We'd like to continue using BEA's driver for the
    support and the fact that we use Weblogic Server for all of our
    online applications, but this new data might mean that I have to
    switch drivers for this particular application.Thanks. No, there is no known issue, and if you put a packet sniffer
    between the client and DBMS, you will probably not see any appreciable
    difference in the content of the SQL sent be either driver. My suspicion is
    that it involves the historical backward compatibility built in to the DBMS.
    It must still handle several iterations of older applications, speaking obsolete
    versions of the DBMS protocol, and expecting different DBMS behavior!
    Our driver presents itself as a SQL7-level application, and may well be treated
    differently than a newer one. This may include different query processing.
    Because our driver is deprecated, it is unlikely that it will be changed in
    future. We will certainly support you using the MS driver, and if you look
    in the MS JDBC newsgroup, you'll see more answers from BEA folks than
    from MS people!
    Joe
    >
    >
    Mike
    The next test you should do, to isolate the issue, is to try another
    JDBC driver.
    MS provides a type-4 driver now, for free. If it is significantly faster,
    it would be
    interesting. However, it would still not isolate the problem, because
    we still would
    need to know what query plan is created by the DBMS, and why.
    Joe Weinstein at BEA
    PS: I can only tell you that our driver has not changed in it's semantic
    function.
    It essentially send SQL to the DBMS. It doesn't alter it.

  • About query related problem

    hi ,
           we are generate query in 2005b,and procced for execuite query.following problem occure'<b>odbc sql server driver'[sql server] syntax error the converting the nvarchar value' 70302/20307' to column of data type int received alert OAIB</b>
    QUERY SHOWN BE AS FOLLOW.
    SELECT T5.DocNum as'Po. No. ', T5.DocDate as 'Po Date',T0.CreateDate,T5.NumAtCard as 'Man.PO. No/ Dt.', T0.DocNum as'AP No. ', T0.DocDate as 'AP Date',T0.NumAtCard as 'Vendor Ref. No.', T0.U_vbdt as 'Vendor Ref. Date', T0.CardName as 'Vendor', T1.Dscription as 'Item',  T1.Quantity AS 'QTY'  , T1.Price as 'Basic Rate', (T1.Price *T1.Quantity) as 'Value',T0.Comments as 'Po No. & Po.Dt.' FROM OPCH T0 INNER JOIN PCH1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode INNER JOIN OPDN T3 ON T2.CardCode = T3.CardCode INNER JOIN PDN1 T4 ON T3.DocEntry = T4.DocEntry INNER JOIN OPOR T5 ON T2.CardCode = T5.CardCode INNER JOIN POR1 T6 ON T5.DocEntry = T6.DocEntry INNER JOIN OITM T7 ON T1.ItemCode = T7.ItemCode INNER JOIN OITB T8 ON T7.ItmsGrpCod = T8.ItmsGrpCod WHERE (  T1.BaseRef  =  T3.DocNum )  AND ( T4.BaseRef =  T5.DocNum ) AND (  T0.U_vbdt >=[%25]AND  T0.U_vbdt <=[%26]) AND ( T4.Dscription =T1.Dscription ) AND ( T4.Dscription = T6.Dscription  ) AND  (( T1.Dscription=[%0] OR T1.Dscription=[%1] OR T1.Dscription=[%2] OR T1.Dscription=[%3] OR T1.Dscription=[%4] OR T1.Dscription=[%5] OR T1.Dscription=[%6] OR T1.Dscription=[%7] OR T1.Dscription=[%8] ) OR ( T0.CardName=[%10] OR T0.CardName=[%09] OR T0.CardName=[%27] OR T0.CardName=[%28] ) OR ((  T8.ItmsGrpNam =[%11]  oR T8.ItmsGrpNam =[%12] OR T8.ItmsGrpNam =[%13] OR T8.ItmsGrpNam =[%14] OR T8.ItmsGrpNam =[%15] OR T8.ItmsGrpNam =[%16] OR T8.ItmsGrpNam =[%17] OR T8.ItmsGrpNam =[%18] OR T8.ItmsGrpNam =[%19] ) and  ( T7.U_FirmName =[%20] OR T7.U_FirmName =[%21] OR T7.U_FirmName =[%22] 
    oR T7.U_FirmName =[%23] OR T7.U_FirmName =[%24] )) )

    Hi Vishal,
    the value '70302/20307' is not an whole number so converting it to an int is not possible.
    You should check your data for this value an change your query or data.
    Regards
    Ad

  • User Defined Fields & Tables Problem

    After the upgrade to B1 2007 and converting our database to 2005 compatibility as per the upgrade directions, we’re having some weird issues with our user defined fields and tables. 
    •     Our user defined fields that used to be alpha-numeric when set up in B1 are now in the database as nvarchar(MAX), even after updating the fields in the Manage User Defined Fields screen.  B1 is obviously not setting the right field information as per its interface.
    •     We’re can no longer add records to user defined tables through the B1 interface, though we can add them fine through SQL Server or an ODBC interface.  The error we are getting is
    [Microsoft][SQL Native Client][SQL Server]Conversion failed when converting the nvarchar value '-3 @PASSWORDS' to data type int. (CINF)
    .  I don’t understand where this problem is coming from because there isn’t even a data field that is an integer, so I don’t know what it’s trying to convert.

    Derek,
    I would suggest you post this question to SAP Support by creating a message.  Also search for any notes on this from https://websmp201.sap-ag.de/notes
    Suda

Maybe you are looking for