|
Not sure how that relates to a memory access violation. I think you need to look deeper.
|
|
|
|
|
Definitely I can look into it if you can just give me direction to proceed my friend, really not understanding where is going wrong. Even if the File locked can we just read or close it explicitly to it? Any direction or hint can help me my friend.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
As I mentioned before, to find the access violation you need to catch it in the debugger and look at the stack trace to find where it originated in your code. I think you need to spend more time getting familiar with your debug tools.
|
|
|
|
|
Ok thanks my friend
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
It got fixed just saying if somebody is going through the same, only one thing I changed was I have placed the file in a different location than C drive, could it be the problem? Yes maybe I guess so, but that was the only thing I changed and its Working. Because its saying memory not readable probably that could be the issue - forgive me but its just my guess . Thanks for all you support and taking time my friend.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
That was the crucial piece of evidence you did not mention.
|
|
|
|
|
Post the (complete) exception and stacktrace
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
It got fixed just saying if somebody is going through the same, only one thing I changed was I have placed the file in a different location than C drive, could it be the problem? Yes maybe I guess so, but that was the only thing I changed and its Working. Because its saying memory not readable probably that could be the issue - forgive me but its just my guess . Thanks for all you support and taking time my friend.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Some locations have more rights than others, and not every application or library handles them nice.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi,
I am trying to import Date values of Pipe-Delimited file into Sql Table, I am getting the following error
Error: 0xC0049064 at Populate Stage, Derived Column [97]: An error occurred while attempting to perform a type cast.
Error: 0xC0209029 at Populate Stage, Derived Column [97]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "Derived Column" failed because error code 0xC0049064 occurred, and the error row disposition on "Derived Column.Outputs[Derived Column Output].Columns[Payment Due Date]" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
Error: 0xC0047022 at Populate Stage, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Derived Column" (97)
failed with error code 0xC0209029 while processing input "Derived Column Input" (98). The identified component returned an error from the ProcessInput method.
The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
The Following is the expression I am using for the derived Column
(DT_DATE)(SUBSTRING([Date Posted],1,4) + "-" + SUBSTRING([Date Posted],5,2) + "-" + SUBSTRING([Date Posted],7,2))
I am also trying my best searching online, can anybody please let me know if I am missing anything. Thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
indian143 wrote:
(DT_DATE)(SUBSTRING([Date Posted],1,4) + "-" + SUBSTRING([Date Posted],5,2) + "-" + SUBSTRING([Date Posted],7,2))
Might I suggest the first thing to do is to look at the data being used to get those substrings. According to your code above do they make up a valid date?
|
|
|
|
|
Crappy data, this is very common with dates, track the rows successfully converted - count them and inspect the last row or the next row to be imported. You will find a badly formatted date string.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
thanks I saw that, Date field is coming as empty or null, can you please help me in adding Condition in the below expression so that it can check for the empty string or null else it will take the DateTime.Min value - thanks in advance my friend.
(DT_DBDATE)(SUBSTRING ([Date Posted] ,1,2) + "-"+ SUBSTRING([Date Posted] ,3,2) + "-" + SUBSTRING([Date Posted] ,5,4))
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
|
Yes I did fix this issue, but now that from Data Conversion to Database its stripping the time value and making it to midnight like if its 8/31/2017 12:59:00 AM then its making it to 8/31/2017 00:00:00, this not right, I tried with almost all Date Datatypes like Dt_DbDateTimeStamp or Dt_Date, Dt_DbDate etc, all of these are changing it to the midnight by default, any idea please.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Looking at your original code you are only getting the date, not the time.
|
|
|
|
|
I am getting like this as well in some rows, 8/31/2017 12:59:00 AM, is there anything I am missing or doing wrong buddy?
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
indian143 wrote: is there anything I am missing or doing wrong Yes, you are not looking closely at your code. You have
(DT_DATE)(SUBSTRING([Date Posted],1,4) + "-" + SUBSTRING([Date Posted],5,2) + "-" + SUBSTRING([Date Posted],7,2))
But how do those substring commands relate to the fields in a string of 8/31/2017 12:59:00 AM ?
|
|
|
|
|
Can't tell if you're writing SQL or C#:
"Sub-stringing" "dates" instead of DATEPART; "casting" instead of Sql CAST or CONVERT.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Hi Buddy,
I could able to figure it out some how to convert the values into float, date using Data Conversion of SSIS, but there is one small problem I am getting when I convert the Date string that looks like '8/31/2017 12:59:00 AM' into Dt_DbDateTimeStamp or Dt_Date, it is only importing the like this: '8/31/2017 00:00:00 AM'
Can anybody please suggest me what to do to import the full Date time stamp at least up to minutes or seconds if possible.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
-- modified 5-Oct-17 9:14am.
|
|
|
|
|
Hi,
I am reading an Excel file by using Excel.Interop, its reading all the rows and columns but for a file which has 65536 Rows and 256 Columns, its roughly taking around couple of hrs, I need to finish it within around 10 minutes, is there anything I can do in the below code, any suggestion, code snippet or even link helps me. I have to use only interop no Jet or Ace drivers I can use, here I am putting my code please help me any thing can help - thanks in advance.
static void ReadExcel(String strFileName, string strDelimiter)
{
int RowCount = 0, ColCount = 0;
//Write to text
StreamWriter sw = new StreamWriter(@"C:\Test Files\Test.txt");
String strCell = "";
int col;
Object Opt = Missing.Value;
Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application(); //= new Excel.Application();
//Declare Workbook
Microsoft.Office.Interop.Excel.Workbook book;
//Excel.Worksheet sheet;
Microsoft.Office.Interop.Excel.Worksheet xlsSheet;
Microsoft.Office.Interop.Excel.Range oRng;
//Open Spreadsheet
book = app.Workbooks.Open(strFileName, Opt, Opt, Opt, Opt, Opt, Opt, Opt, Opt, Opt, Opt, Opt, Opt, Opt, Opt);
//Take the first sheet
xlsSheet = (Microsoft.Office.Interop.Excel.Worksheet)book.Sheets[1];
if (xlsSheet != null)
{
//Read the first cell
oRng = (Microsoft.Office.Interop.Excel.Range)xlsSheet.Cells[1, 1];
ColCount = xlsSheet.Columns.Count;
RowCount = xlsSheet.Rows.Count;
}
for (int row = 0; row < RowCount; row++)
{
strCell = "";
for (col = 0; col < ColCount; col++)
{
oRng = (Microsoft.Office.Interop.Excel.Range)xlsSheet.Cells[row + 1, col + 1];
if (col < ColCount - 1)
{
strCell = strCell + oRng.Text.ToString() + strDelimiter;
}
else
{
strCell = strCell + oRng.Text.ToString();
}
}
//Write to text file
sw.WriteLine(strCell);
}
Console.WriteLine(strCell);
sw.Close();
book.Close(false, false, Missing.Value);
}
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
-- modified 3-Oct-17 18:10pm.
|
|
|
|
|
Office Interop = slow. There's no getting around that.
If you're using Excel 2007 or higher formats, like .xlsx, then you can use the OpenXML or ClosedXML SDK's. They will be much faster processing Excel sheets. The down side is there is a rather learning curve associated with using them.
|
|
|
|
|
Read as a CSV, I can predict runtimes in the seconds; if not milliseconds.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
If you're using Excel 2007 files (*.xlsx ), any of the following will work:
If you need to support Excel 2003 files (*.xls ) as well, you'll need something like NPOI[^].
(There are also commercial toolkits around, but I've never seen the need for them when all of the above libraries are free and open-source.)
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
You need to learn program profiling: Profiling (computer programming) - Wikipedia[^]
With a profiler program, you will spot the parts where the computer spend time.
If you don't have such tool, as simple benchmark and runs with changing some values (number of rows and columns) will give you hints.
You will discover that runtime is linear with row numbers, but that it is not with column numbers.
You will see that runtime turn ugly as columns increase. The problem comes from the way you build the string inside the column loop.
Think about your code, and about the reason you do what you do, is it really needed?
Search if there is another way to things.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|