Crystal Data Conversion Issue (Error converting data type varchar to datetime)

Hi,
I can run stored procedure without error in SQL Server using my personal credentials as well as database credentials.
I can also run Crystal Report after connecting to Stored procedure without error on my desktop using my personal credentials as well as database credentials.
But when I upload the crystal report in BOBJDEV and when I run using database credentials report fails saying that "Error in File ~tmp1d1480b8e70fd90.rpt: Unable to connect: incorrect log on parameters. Details: [Database Vendor Code: 18456 ]" but I can run the crystal report successfully on BOBJDEV using my personal credentials.
I googled (Data Conversion Error Message) about this issue & lot of people asked to do "Verify Database" in Crystal Report. So I did that, but when I do it I am getting a error message like this:
Error converting data type varchar to datetime.
Where do you think the error might be occurring? Did anyone faced this kind of issue before? If so, how to resolve it?
(FYI, I am using Crystal Reports 2008, & for stored procedure I have used SSMS 2012 )
Please help me with this issue.
Thanks & Regards.
Naveen.

hello Naveen,
since the report works fine in the cr designer / desktop, we need to figure out where you should post this question.
by bobjdev do you mean businessobjects enterprise or crystal reports server? if so please post this question to the bi platform space.
-jamie

Similar Messages

  • Error converting data type nvarchar to numeric 'witholding tax' (OWHT)

    Hi Guys.
    After I have upgraded my clients 2007 PL 30 database to 8.81 PL05, and running a repair to fix inconsistincies, I am receiveing some error when opening any sales documents.
    It takes place when I open a sales document, or browse previous docs. When browsing previous docs, it onlly happens on some of them.
    I also receive a different error when viewing sales orders: Error converting data type nvarchar to numeric (CRD2).
    Any ideas how to fix it?
    It does not limit me from processing and using the rest of the functionality. All calculations with queries in the docs are still working.
    Thanks.

    Hi,
    Please check Note No. : 1402855 and see if the same applied to the issue mentioned by you.
    Kind Regards,
    Jitin
    SAP Business One Forum Team

  • CF9, no hotfix, VendorErrorCode 8114, cfprocresult error converting data type

    Hello, everyone.
    I've got an issue that really has me scratching my head.  Not sure where the issue lies, but I'll explain as best I can.
    Basically, I _think_ I'm being told that one of the fields in the recordset is not being converted.
    On one page, I make the following CFINVOKE:
    <cfinvoke component="components.header" method="content_single" returnvariable="resultset"
         dbdsn="#request.db_dsn#" dbusr="#request.db_username#" dbpwd="#request.db_password#">
         <cfinvokeargument name="table" value="#url.table#">
         <cfif isDefined("url.thisNav") AND len(trim(url.thisNav)) gt 0><cfinvokeargument name="pt" value="#trim(url.thisNav)#"></cfif>
         <cfif isDefined("url.id") AND val(url.id) gt 0><cfinvokeargument name="id" value="#val(url.id)#"></cfif>
         <cfif isDefined("url.section") AND len(trim(url.section)) gt 0><cfinvokeargument name="section" value="#trim(url.section)#"></cfif>
    </cfinvoke>
    Within a CFCOMPONENT in header.cfc, I have the following:
    <cffunction name="content_single" access="public">
             <cfargument name="dbdsn" required="yes">
             <cfargument name="dbusr" required="yes">
             <cfargument name="dbpwd" required="yes">
         <cfargument name="pt" required="no">
         <cfargument name="id" required="no">
         <cfargument name="section" required="no">
         <cfargument name="table" required="yes">
         <cfstoredproc procedure="SRT_sp_#lcase(url.table)#_contents_single" datasource="#dbdsn#"
                 username="#dbusr#" password="#dbpwd#"
                result="query_result">
            <cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" variable="@table" value="#lcase(table)#" maxlength="30">
    <cfif isDefined("pt") AND len(trim(pt)) gt 0><cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" variable="@pt" value="#ucase(pt)#" maxlength="12" null="no"></cfif>
    <cfif isDefined("id") AND val(id) gt 0><cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" variable="@id" value="#val(id)#" maxlength="10" null="no"></cfif>
    <cfif isDefined("section") AND len(trim(section)) gt 0><cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" variable="@section" value="#trim(replace(lcase(section),'_',' ','all'))#" maxlength="20" null="no"></cfif>
                <cfprocresult name="returned_result">
            </cfstoredproc>
              <cfreturn returned_result>
    </cffunction>
    Instead of the results I expect, I get the following error:
    Error  Executing Database Query.
    [Macromedia][SQLServer JDBC  Driver][SQLServer]Error converting data type varchar to int.
    The  error occurred in E:\xxxxxxxx\xxxxxxx\xxxx\components\header.cfc: line  17
    Called from E:\xxxxxxxx\xxxxxxx\xxxx\content_view.cfm:  line 24
    Called from E:\xxxxxxxx\xxxxxxx\xxxx\components\header.cfc: line 17
    Called  from E:\xxxxxxxx\xxxxxxx\xxxx\content_view.cfm: line  24
    15 :     <cfif isDefined("id") AND val(id) gt 0><cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" variable="@id" value="#val(id)#" maxlength="10" null="no"></cfif>
    16 :     <cfif isDefined("section") AND len(trim(section)) gt 0><cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" variable="@section" value="#trim(replace(lcase(section),'_',' ','all'))#" maxlength="20" null="no"></cfif>
    17 :             <cfprocresult name="returned_result">
    18 :         </cfstoredproc>
    19 :           <cfreturn returned_result>

    DBVARNAME is obsolete: don't use it.  You must pass-in the parameters positionally, not by name.  And, accordingly, you need to pass all of them in (with null values, if necessary).
    http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7d 52.html:
    {quote}
    Changed the dbvarname attribute behavior: it is now ignored for all drivers
    {quote}
    Adam

  • Saving result from sp_executesql into a variable and using dynamic column name - getting error "Error converting data type varchar to numeric"

    Im getting an error when running a procedure that includes this code.
    I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql
    DECLARE @retval AS DECIMAL(12,2)
    DECLARE @MonthVal VARCHAR(20), @SpreadKeyVal INT
    DECLARE @sqlcmd AS NVARCHAR(150)
    DECLARE @paramdef NVARCHAR(150)
    SET @MonthVal = 'Month' + CAST(@MonthNumber AS VARCHAR(2) );
    SET @SpreadKeyVal = @SpreadKey; --CAST(@SpreadKey AS VARCHAR(10) );
    SET @sqlcmd = N' SELECT @retvalout = @MonthVal FROM dbo.CourseSpread WHERE CourseSpreadId = @SpreadKeyVal';
    SET @paramdef = N'@MonthVal VARCHAR(20), @SpreadKeyVal INT, @retvalout DECIMAL(12,2) OUTPUT'
    --default
    SET @retval = 0.0;
    EXECUTE sys.sp_executesql @sqlcmd,@paramdef, @MonthVal = 'Month4',@SpreadKeyVal = 1, @retvalout = @retval OUTPUT;
    SELECT @retval
    DECLARE @return_value DECIMAL(12,2)
    EXEC @return_value = [dbo].[GetSpreadValueByMonthNumber]
    @SpreadKey = 1,
    @MonthNumber = 4
    SELECT 'Return Value' = @return_value
    Msg 8114, Level 16, State 5, Line 1
    Error converting data type varchar to numeric.

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
    to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for: 
    https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
    >> I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql <<
    This is so very, very wrong! A column is an attribute of an entity. The idea that you are so screwed up that you have no idea if you want
    the shoe size, the phone number or something else at run time of this entity. 
    In Software Engineering we have a principle called cohesion that says a model should do one and only one task, have one and only one entry point, and one and only one exit point. 
    Hey, on a scale from 1 to 10, what color is your favorite letter of the alphabet? Yes, your mindset is that level of sillyity and absurdity. 
    Do you know that SQL is a declarative language? This family of languages does not use local variables! 
    Now think about “month_val” and what it means. A month is a temporal unit of measurement, so this is as silly as saying “liter_val” in your code. Why did you use “sp_” on a procedure? It has special meaning in T-SQL.  
    Think about how silly this is: 
     SET @month_val = 'Month' + CAST(@month_nbr AS VARCHAR(2));
    We do not do display formatting in a query. This is a violation of at the tiered architecture principle. We have a presentation layer. But more than that, the INTERVAL temporal data type is a {year-month} and never just a month. This is fundamental. 
    We need to see the DDL so we can re-write this mess. Want to fix it or not?
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Error "Conversion failed when converting date and/or time from character string" to execute one query in sql 2008 r2, run ok in 2005.

    I have  a table-valued function that run in sql 2005 and when try to execute in sql 2008 r2, return the next "Conversion failed when converting date and/or time from character string".
    USE [Runtime]
    GO
    /****** Object:  UserDefinedFunction [dbo].[f_Pinto_Graf_P_Opt]    Script Date: 06/11/2013 08:47:47 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE   FUNCTION [dbo].[f_Pinto_Graf_P_Opt] (@fechaInicio datetime, @fechaFin datetime)  
    -- Declaramos la tabla "@Produc_Opt" que será devuelta por la funcion
    RETURNS @Produc_Opt table ( Hora datetime,NSACOS int, NSACOS_opt int)
    AS  
    BEGIN 
    -- Crea el Cursor
    DECLARE cursorHora CURSOR
    READ_ONLY
    FOR SELECT DateTime, Value FROM f_PP_Graficas ('Pinto_CON_SACOS',@fechaInicio, @fechaFin,'Pinto_PRODUCTO')
    -- Declaracion de variables locales
    DECLARE @produc_opt_hora int
    DECLARE @produc_opt_parc int
    DECLARE @nsacos int
    DECLARE @time_parc datetime
    -- Inicializamos VARIABLES
    SET @produc_opt_hora = (SELECT * FROM f_Valor (@fechaFin,'Pinto_PRODUC_OPT'))
    -- Abre y se crea el conjunto del cursor
    OPEN cursorHora
    -- Comenzamos los calculos 
    FETCH NEXT FROM cursorHora INTO @time_parc,@nsacos
    /************  BUCLE WHILE QUE SE VA A MOVER A TRAVES DEL CURSOR  ************/
    WHILE (@@fetch_status <> -1)
    BEGIN
    IF (@@fetch_status = -2)
    BEGIN
    -- Terminamos la ejecucion 
    BREAK
    END
    -- REALIZAMOS CÁLCULOS
    SET @produc_opt_parc = (SELECT dbo.f_P_Opt_Parc (@fechaInicio,@time_parc,@produc_opt_hora))
    -- INSERTAMOS VALORES EN LA TABLA
    INSERT @Produc_Opt VALUES (@time_parc,@nsacos, @produc_opt_parc)
    -- Avanzamos el cursor
    FETCH NEXT FROM cursorHora INTO @time_parc,@nsacos
    END
    /************  FIN DEL BUCLE QUE SE MUEVE A TRAVES DEL CURSOR  ***************/
    -- Cerramos el cursor
    CLOSE cursorHora
    -- Liberamos  los cursores
    DEALLOCATE cursorHora
    RETURN 
    END

    You can search the forums for that error message and find previous discussions - they all boil down to the same problem.  Somewhere in your query that calls this function, the code invoked implicitly converts from string to date/datetime.  In general,
    this works in any version of sql server if the runtime settings are correct for the format of the string data.  The fact that it works in one server and not in another server suggests that the query executes with different settings - and I'll assume for
    the moment that the format of the data involved in this conversion is consistent within the database/resultset and consistent between the 2 servers. 
    I suggest you read Tibor's guide to the datetime datatype (via the link to his site below) first - then go find the actual code that performs this conversion.  It may not be in the function you posted, since that function also executes other functions. 
    You also did not post the query that calls this function, so this function may not, in fact, be the source of the problem at all. 
    Tibor's site

  • SAP query error - 1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string.  'Received Alerts' (OAIB)

    SAP query error - 1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string.  'Received Alerts' (OAIB)
    SELECT    
    CASE WHEN T0.DocStatus = 'O' THEN 'OPEN'
    WHEN T0.DocStatus = 'C' THEN 'CLOSED'  END  AS 'Document Status',
    T0.DocDate AS 'Posting Date',
    T0.DocNum AS 'Doc.No',
    T0.NumAtCard,
    T0.TransId AS 'Trans. No.',
    T0.Comments AS 'Remarks',
    T0.CardCode AS 'Offset Acct',
    T0.CardName AS 'Offset Acct Name',
    sum(T0.DocTotal) + (T0.WTSum) as 'DocTotal',
    T3.DueDate AS 'Cheque Date',
    T3.CheckSum AS 'Amount'
    FROM         ODPO AS T0 LEFT OUTER JOIN
                          VPM2 AS T1 ON T0.ObjType = T1.InvType AND T0.DocEntry = T1.DocEntry LEFT OUTER JOIN
         OVPM AS T2 ON T2.DocEntry = T1.DocNum LEFT OUTER JOIN
                          VPM1 AS T3 ON T2.DocEntry = T3.DocNum
    where T0.DocDate>='[%0]' and T0.DocDate<='[%1]'

    Hi,
    Try this:
    SELECT   
    CASE WHEN T0.DocStatus = 'O' THEN 'OPEN'
    WHEN T0.DocStatus = 'C' THEN 'CLOSED'  END  AS 'Document Status',
    T0.DocDate AS 'Posting Date',
    T0.DocNum AS 'Doc.No',
    T0.NumAtCard,
    T0.TransId AS 'Trans. No.',
    T0.Comments AS 'Remarks',
    T0.CardCode AS 'Offset Acct',
    T0.CardName AS 'Offset Acct Name',
    sum(T0.DocTotal) + (T0.WTSum) as 'DocTotal',
    T3.DueDate AS 'Cheque Date',
    T3.CheckSum AS 'Amount'
    FROM         ODPO  T0 LEFT OUTER JOIN
                          VPM2  T1 ON T0.ObjType = T1.InvType AND T0.DocEntry = T1.DocEntry
    LEFT OUTER JOIN
         OVPM  T2 ON T2.DocEntry = T1.DocNum LEFT OUTER JOIN
                          VPM1  T3 ON T2.DocEntry = T3.DocNum
    where T0.DocDate >= '[%0]' and T0.DocDate <='[%1]'
    group by T0.DocStatus,T0.DocDate ,
    T0.DocNum ,
    T0.NumAtCard,
    T0.TransId ,
    T0.Comments ,
    T0.CardCode,
    T0.CardName ,
    T0.WTSum ,
    T3.DueDate ,
    T3.CheckSum
    Thanks & Regards,
    Nagarajan

  • Conversion failed when converting date and/or time from character string

    Hi experts,
    I'm trying running a query in Microsoft Query but it gives the following error message:
    "conversion failed when converting date and/or time from character string"
    when asks me the data I'm inserting 31-01-2014
    i've copy the query form the forum:
    SELECT T1.CardCode, T1.CardName, T1.CreditLine, T0.RefDate, T0.Ref1 'Document Number',
         CASE  WHEN T0.TransType=13 THEN 'Invoice'
              WHEN T0.TransType=14 THEN 'Credit Note'
              WHEN T0.TransType=30 THEN 'Journal'
              WHEN T0.TransType=24 THEN 'Receipt'
              END AS 'Document Type',
         T0.DueDate, (T0.Debit- T0.Credit) 'Balance'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')<=-1),0) 'Future'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>=0 and DateDiff(day, T0.DueDate,'[%1]')<=30),0) 'Current'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>30 and DateDiff(day, T0.DueDate,'[%1]')<=60),0) '31-60 Days'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>60 and DateDiff(day, T0.DueDate,'[%1]')<=90),0) '61-90 Days'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>90 and DateDiff(day, T0.DueDate,'[%1]')<=120),0) '91-120 Days'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>=121),0) '121+ Days'
    FROM JDT1 T0 INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode
    WHERE (T0.MthDate IS NULL OR T0.MthDate > ?) AND T0.RefDate <= ? AND T1.CardType = 'C'
    ORDER BY T1.CardCode, T0.DueDate, T0.Ref1

    Hi,
    The above error appears due to date format is differnt from SAP query generator and SQL server.
    So you need convert all date in above query to SQL server required format.
    Try to convert..let me know if not possible.
    Thanks & Regards,
    Nagarajan

  • Oracle Database : Date conversion issue between timezones

    Hi All,
    We are trying to convert date from Eurpoer/Amsterdam timezone to Australia/Sydnet timezone and extracting time out of it.
    We are facing issue related to incorrect timing after conversion.
    Please find below issue details,
    Environment
    Database: Oracle 10.2.0.4
    Machine: Linux RHEL 4
    Location: Amsterdam, Netherlands
    Issue: After converting date from Eurpoer/Amsterdam timezone to Australia/Sydnet timezone
    SELECT TO_CHAR (FROM_TZ (TO_TIMESTAMP ('201110201416', 'YYYYMMDDHH24MI'),
    DBTIMEZONE
    ) AT TIME ZONE 'Australia/Sydney', 'HH24:MI')
    FROM DUAL
    Output of above SQL is 22:16.
    Expected output is 23:16
    Database Timezone (DBTIMEZONE) is set to +02:00 (i.e. GMT + 2) (Europe/Amsterdam)
    If we convert date to Australia/Tasmania timezone then we get expected output i.e. 23:16.
    Question: Expected time for Australia/sydney is 23:16, but why Oracle database provides 22:16 as output.
    Please note that, Sydney and Tasmania comes under same timezone. Still we get different output for both the timezone.
    Oracle database considers GMT + 10 for Australia/sydney and GMT + 11 for Australia/Tasmania.
    If we want to use Australia/sydney then how should we get correct sydney time?
    Regards
    Shailendra

    I made a test and it showed when I omit TO_CHAR, both queries have the same result 11:15 PM. So it's TO_CHAR which is the 'culprit'. Since this is a globalization issue, you may repeat your question in this forum:
    Globalization Support
    (So one of the moderators moves the thread to this forum).
    Werner
    By the way my local timezone is Europe/Berlin, there should be no difference to Amsterdam.

  • Error converting data when updating table

    Hi,
    I need to understand why I cannot gat my update to work properly, I have to concat 4 fields (numbers with leading zeros so I can create a new number with leading 1. My field is already set as a bigint but I cannot convert the resulting string properly
    UPDATE table 
    set field = convert(bigint, '1', strfield1 + strfield2 + strfield3 + strfield4)
                                           1,  001      
    +   0125   + 0045      + 004568 
    The end result need to return the number 100101250045004568  to be inserted into a bigint field but I always get the following error:
    Error converting data type nvarchar to bigint
    If I try a select , it shows the proper result, so what am I missing here

    Guess I will have to wait for our new SQLServer 2012, coming in next week, I have tried every possible cast, convert possibility to make it work.
    Thank you all
    Al
    This should work fro SQL Server 2008 R2
    select CAST(('1'+ strfield1 + strfield2 + strfield3 +strfield4) AS BIGINT);
    web: www.ronnierahman.com

  • Why the delivery date is the same date as 'transptn plan date" & loading date' & ' good issue' & GR end date'

    Hi Experts,
    why the delivery date is the same date as ‘transptn plan date” & loading date’ & ‘ good issue’ & GR end date’.
    in shipping tab i can see Planned Deliv. Time  170 Days ... wat could be the reason.
    Many Thanks:
    Raj Kashyap

    Hi Jurgen,,
    Thanks for quick reply!!
    But i didnot find any things like that .. what could be the customizing .. and we are using GATP from APO side.
    \Raj Kashyap

  • I have proubleam with string to date conversion, i out put date fromat is 2012-04-30T23:48:55.727-07:00 . so please help me the format conversion

    i have proubleam with string to date conversion, i out put date fromat is 2012-04-30T23:48:55.727-07:00 . so please help me the format conversion.
    i wrote the method but it not workig
    My method is
    -(NSDate *)dateformstr:(NSString *)str
    NSString *date = [str stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        NSDateFormatter *dateFormate = [[NSDateFormatter alloc] init];
      [dateFormate setDateFormat:@"yyyy-MM-dd'T'HH:mm:sssZZZZ"]
    // NSDate *formatterDate = [dateFormate  dateFromString:str];
        return formatterDate;
    but i did not the value and if i try othere formate i is working but my requiremet format is 2012-04-30T23:48:55.727-07:00.
    can any help it out in this senario.

    Sorry Butterbean, but I'm interested in the answer to your question myself.
    I've spent a few hours transfering my library from one computer to another and then find out that my ratings didn't transfer. Like you, I've spent many hours rating my 2000+ songs. I'm sure you have more, nevertheless, I want to find out how to get those ratings. They still show in my iTunes on my laptop but, when I go to the iTunes folder and display the details of at song, no rating is there. If you find out how to get them to display there in the iTunes folder, it seems that would be the key.
    Hope you get your answer soon.

  • What is Data conversion ? What are data conversion programs ? please give

    What is Data conversion ? What are data conversion programs ? please give me some sample code?

    Hi,
    I think you mean "Data Acquisition"...
    "The Data Acquisition IT process allows you to connect heterogeneous sources (SAP systems, database management systems, files, relational data, multidimensional data) to BI. You can transfer data straight into BI from the source or use SAP NetWeaver XI to transfer data. Furthermore, the process supports direct access to source data, without having to load it into BI."
    http://help.sap.com/saphelp_nw04s/helpdata/en/aa/1fb042e745ca6ae10000000a155106/frameset.htm
    [Data AcquisitionTechniques in SAP NetWeaver BI|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/329fcd87-0c01-0010-4a9c-86f038e11d23]
    Regards
    Andreas

  • Using sql bulk copy throwing exception -The given value of type String from the data source cannot be converted to type int of the specified target column

    Hi All,
    I am reading notepads files and inserting data in sql tables from the notepad-
    while performing sql bulk copy on this line it throws exception - "bulkcopy.WriteToServer(dt); -"data type related(mentioned in subject )".
    Please go through my  logic and tell me what to change to avoid this error -
    public void Main()
    Dts.TaskResult = (int)ScriptResults.Success;
    string[] filePaths = Directory.GetFiles(@"C:\Users\jainruc\Desktop\Sudhanshu\master_db\Archive\test\content_insert\");
    for (int k = 0; k < filePaths.Length; k++)
    string[] lines = System.IO.File.ReadAllLines(filePaths[k]);
    //table name needs to extract after = sign
    string[] pathArr = filePaths[0].Split('\\');
    string tablename = pathArr[9].Split('.')[0];
    DataTable dt = new DataTable(tablename);
    |
    string[] arrColumns = lines[1].Split(new char[] { '|' });
    foreach (string col in arrColumns)
    dt.Columns.Add(col);
    for (int i = 2; i < lines.Length; i++)
    string[] columnsvals = lines[i].Split(new char[] { '|' });
    DataRow dr = dt.NewRow();
    for (int j = 0; j < columnsvals.Length; j++)
    //Console.Write(columnsvals[j]);
    if (string.IsNullOrEmpty(columnsvals[j]))
    dr[j] = DBNull.Value;
    else
    dr[j] = columnsvals[j];
    dt.Rows.Add(dr);
    SqlConnection conn = new SqlConnection();
    conn.ConnectionString = "Data Source=UI3DATS009X;" + "Initial Catalog=BHI_CSP_DB;" + "User Id=sa;" + "Password=3pp$erv1ce$4";
    conn.Open();
    SqlBulkCopy bulkcopy = new SqlBulkCopy(conn);
    bulkcopy.DestinationTableName = dt.TableName;
    bulkcopy.WriteToServer(dt);
    conn.Close();
    Issue 1:-
    I am reading notepad: getting all column and values in my data table now while inserting for date and time or integer field i need to do explicit conversion how to write for specific column before bulkcopy.WriteToServer(dt);
    Issue 2:- Notepad does not contains all columns nor in specific sequence in that case i can add few column ehich i am doing now but the issue is now data table will add my columns + notepad columns and while inserting how to assign in perticular colums?
    sudhanshu sharma Do good and cast it into river :)

    Hi,
    I think you'll have to do an explicit column mapping if they are not in exact sequence in both source and destination.
    Have a look at this link:
    https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopycolumnmapping(v=vs.110).aspx
    Good Luck!
    Kaur.
    Please mark as answer if this resolves your issue.

  • Data Conversion issue

    Hello I'm new to Oracle DB and still learn SQL.
    I have a problem with data conversion in a CASE expression.
    Example:
    select ... ,     
    CASE column WHEN 1 THEN
    select max(column)
    from table
    where ...
    ELSE 0 END AS value,
    from     ...
    where ...
    order by ...
    What I'm basically intend to do is to select a value from another table depending on the value of
    a special column.
    The problem now is that the
    select max(column)
    from table
    where ...
    statement in its original form selects the right value as float (e.g. 0.24)which I need.
    But the same statement embedded in the CASE expression returns (e.g. 0 ) which seems to be the same result converted to an integer or something.
    I tried to convert the result in the CASE expression but without success.
    Does anybody know what could cause this behavior and how to fix it ?
    Thanks for any help with this.

    Welcome to the forum!
    Whenever you have a problem, post a complete script that people can run to re-create the problem. Include CREATE TABLE and INSERT statements for a little sample data if necessary. (A lot of folks show the problem using commonly available tables, such as those in the scott or hr schemas, so they don't have to post any sample data.)
    if your problem involves an error message, post the complete error message you're getting, including line numbers.
    Always say which version of Oracle you're using, e.g. 10.2.0.1.0.
    Sorry, I can't re-create the problem.
    I did something as similar as I could to what you posted:
    SELECT       deptno
    ,       CASE deptno
              WHEN  10
              THEN  (
                   SELECT  MAX (sal)
                   FROM     scott.emp
                   WHERE     deptno     = d.deptno
              ELSE  0
           END          AS value
    ,       dname
    FROM       scott.dept     d
    WHERE       deptno     <= 30
    ORDER BY  deptno
    ;And it ran, producing this output:
    `   DEPTNO      VALUE DNAME
            10       5000 ACCOUNTING
            20          0 RESEARCH
            30          0 SALES
    886562 wrote:Hello I'm new to Oracle DB and still learn SQL.I've been using Oracle for 20 years, and still learn SQL.
    select ... ,     
    CASE column WHEN 1 THEN
    select max(column)
    from table
    where ...
    ELSE 0 END AS value,
    The problem now is that the
    select max(column)
    from table
    where ...
    statement in its original form selects the right value as float (e.g. 0.24)which I need.
    But the same statement embedded in the CASE expression returns (e.g. 0 ) which seems to be the same result converted to an integer or something.Are you sure that 0 is being returned by the sub-query in the THEN clause, and not by the ELSE clause?
    I tried to convert the result in the CASE expression but without success.What did you try? Post your code.
    What problem did you have? Post the error message.
    Edited by: Frank Kulash on Sep 21, 2011 6:15 AM

  • LSMW - Read Data not showing in Converted Data

    Hi,
    I am using LSMW to load data from a flat file (via recording).  I have it working except I have one issue.  When I display the data in read data all fields are showing.  No errors popup when I select convert data.  When I select display converted data the last few fields are missing.  Any ideas why or how to fix this?
    Any help is appreciated as I do not know how to proceed.
    Thanks,
    Annette
    Edited by: Annette Ameel on Dec 4, 2008 5:37 PM

    HI Bush,
    Currently I am also facing the same problem. In "display read data" it is showing all the field values. No error msg in "convert data". But only 2 fields are displaying in "display converted data". not showing any values in rest of the fields. Kindly suggest me how you fixed this problem

Maybe you are looking for

  • How to Create a Variant BOM

    Hi All, Can you please let me know the Process of How to Create a VariantBOM? Preferebly Step-by-Step Process? Highly appreciate for your valuable inputs. Thanks and Regards, Venkat Edited by: venkat Korada on Jan 3, 2008 10:14 AM

  • Can i use Hibernate for this?

    Hi all, I have this use case which i want to optimize. Any help is really appreciated. Say a user "on average" has 100 records in user_info table. I do almost 50 queries on user_info table for that user, usually selecting aggregate of a value column

  • Error while running 10g web services tutorial

    I am trying to learn and evaluate JDev 10g. I followed the web services tutorial for 10g. In the end when I tried to run the example I get the following error. Any help will be appreciated. Thanks. PS: I am also seeing this error in the message pane

  • Vendor name Changes

    What is the SAP standard process for a vendor that changes it's name?  Do you create a new vendor?  If you create a new vendor, how do you link the old vendor data?

  • Standard Functions

    Hi All , I am in Urgent need of a  Comperehensive Article describing Standard functions in XI . The requirement  is an article/weblog/practice sesion /seminar  with examples explaining the standard functions provided in XI mapping. Kindly help (anyth