Split flat file column data into multiple columns using ssis
Hi All, I need one help in SSIS.
I have a source file with column1, I want to split the column1 data into
multiple columns when there is a semicolon(';') and there is no specific
length between each semicolon,let say..
Column1:
John;Sam;Greg;David
And at destination we have 4 columns let say D1,D2,D3,D4
I want to map
John -> D1
Sam->D2
Greg->D3
David->D4
Please I need it ASAP
Thanks in Advance,
RH
sql
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Imports System.IO
Public Class ScriptMain
Inherits UserComponent
Private textReader As StreamReader
Private exportedAddressFile As String
Public Overrides Sub AcquireConnections(ByVal Transaction As Object)
Dim connMgr As IDTSConnectionManager90 = _
Me.Connections.Connection
exportedAddressFile = _
CType(connMgr.AcquireConnection(Nothing), String)
End Sub
Public Overrides Sub PreExecute()
MyBase.PreExecute()
textReader = New StreamReader(exportedAddressFile)
End Sub
Public Overrides Sub CreateNewOutputRows()
Dim nextLine As String
Dim columns As String()
Dim cols As String()
Dim delimiters As Char()
delimiters = ",".ToCharArray
nextLine = textReader.ReadLine
Do While nextLine IsNot Nothing
columns = nextLine.Split(delimiters)
With Output0Buffer
cols = columns(1).Split(";".ToCharArray)
.AddRow()
.ID = Convert.ToInt32(columns(0))
If cols.GetUpperBound(0) >= 0 Then
.Col1 = cols(0)
End If
If cols.GetUpperBound(0) >= 1 Then
.Col2 = cols(1)
End If
If cols.GetUpperBound(0) >= 2 Then
.Col3 = cols(2)
End If
If cols.GetUpperBound(0) >= 3 Then
.Col4 = cols(3)
End If
End With
nextLine = textReader.ReadLine
Loop
End Sub
Public Overrides Sub PostExecute()
MyBase.PostExecute()
textReader.Close()
End Sub
End Class
Put this code in ur script component. Before that add 5 columns to the script component output and name them as ID, col1, co2..,col4. ID is of data type int. Create a flat file destination and name it as connection and point it to the flat file as the source.
Im not sure whats the delimiter in ur flat file between the 2 columns. I have use a comma change it accordingly.
This is the output I get:
ID Col1
Col2 Col3
Col4
1 john
Greg David
Sam
2 tom
tony NULL
NULL
3 harry
NULL NULL
NULL
Similar Messages
-
Want to insert a XSL file's data into a column of type SYS.XMLTYPE??
Hello Friends
I want to insert a XSL file's data into a column of a table of type SYS.XMLTYPE. Following is the XSL which i want to add into a table please help in.....
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="html" encoding="UTF-8" />
<xsl:template match="clinical_study">
<xsl:variable name="status">
<xsl:apply-templates select='overall_status' />
</xsl:variable>
<html>
<head>
<title>Summary</title>
<link href="merckcancer.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="trialtop" class="trialtop">
<div id="trialtophead" class="trialtophead">
<H1>Summary</H1>
</div>
<!-- start of trial body-->
<div id="trialmiddle" class="trialmiddle">
<span class="trialtitle1"><xsl:apply-templates select='brief_title'/></span>
<span class="tealbold">Official Title: </span><xsl:apply-templates select='official_title' />
<span class="tealbold" title="ClinicalTrials.gov Identifier">NCT Id: </span><xsl:apply-templates select='//nct_id'/>
<span class="tealbold">Conditions: </span><xsl:for-each select="//condition[position()!=last()]"><xsl:value-of select="normalize-space(.)" /><xsl:text>, </xsl:text></xsl:for-each>
<xsl:for-each select="//condition[position()=last()]"><xsl:value-of select="normalize-space(.)" /></xsl:for-each>
<span class="tealbold">Phase: </span><xsl:apply-templates select='phase' />
<span class="tealbold">Status: </span><xsl:value-of select="$status" />
<span class="tealbold">Interventions: </span><xsl:for-each select="//intervention[position()!=last()]"><xsl:value-of select="normalize-space(intervention_type)" />: <xsl:value-of select="normalize-space(intervention_name)" /><xsl:text>, </xsl:text></xsl:for-each><xsl:for-each select="//intervention[position()=last()]"><xsl:value-of select="normalize-space(intervention_type)" />: <xsl:value-of select="normalize-space(intervention_name)" /></xsl:for-each>
<xsl:apply-templates select='eligibility'><xsl:with-param name="type">short</xsl:with-param></xsl:apply-templates>
</div><!-- end of middle -->
</div><!-- end of top-->
<div id="detail" class="detail">
<div id="detailtophead" class="detailtophead">
<H1>Details</H1>
</div>
<!-- end of detailtop-->
<!-- start of detail body-->
<div id="detailmiddle" class="detailmiddle">
<span class="trialtitle2">Trial Description:</span>
<span class="trialtitle4"><xsl:apply-templates select='brief_summary/textblock' /></span>
<span class="trialtitle1">Eligibility: </span>
<xsl:apply-templates select='eligibility'><xsl:with-param name="type">long</xsl:with-param></xsl:apply-templates>
</div><!--end of detail middle-->
</div><!-- end of detail top-->
<div id="enroll" class="enroll">
<div id="enrolltophead" class="enrolltophead">
<H1>Enrollment</H1>
</div>
<!-- end of enroll top head-->
<!-- start of enroll body-->
<div id="enrollmiddle" class="enrollmiddle">
<xsl:choose>
<xsl:when test="$status = 'Recruiting'">
This study has participating centers in a number of locations.
To take the next step in learning more about participating in this clinical study please call one of these trial contacts.<p/>
The trial contacts will know this study as <span class="tealbold"><xsl:apply-templates select='//org_study_id'/></span>
or may know the study under the ClinicalTrials.gov identifier <span class="tealbold"><xsl:apply-templates select='//nct_id'/></span>.<p/>
<p/>
<xsl:apply-templates select='overall_contact'/>
<xsl:for-each select="location">
<xsl:call-template name='location'/><p/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
This study is not currently Recruiting, it is <xsl:value-of select="$status" />.
</xsl:otherwise>
</xsl:choose>
</div><!--end of enroll middle-->
</div><!-- end of enroll -->
<div id="credit" class="credit">
<div id="credittophead" class="credittophead">
<H1>Credits</H1>
</div>
<!-- end of credit top head-->
<!-- start of credit body-->
<div id="creditmiddle" class="creditmiddle">
Information about this trial has been gathered from ClinicalTrials.gov. Please see
<a>
<xsl:attribute name="href" >
/ctcpub/redirect.jsp?redirectURL=http://ClinicalTrials.gov
</xsl:attribute>
ClinicalTrials.gov
</a> for more complete information.<p/>
<xsl:apply-templates select='required_header/download_date'/><p/>
<a>
<xsl:attribute name="href" >
/ctcpub/redirect.jsp?redirectURL=<xsl:apply-templates select='required_header/url'/>
</xsl:attribute>
<xsl:apply-templates select='required_header/link_text'/>
</a> <p/>
This trial data was last updated on <xsl:apply-templates select='//lastchanged_date'/><p/>
</div><!--end of credit body-->
</div><!--end of credit-->
</body>
</html>
</xsl:template>
<xsl:template match="brief_title">
<span class="trialtitle"><xsl:value-of select="normalize-space(.)" /></span>
</xsl:template>
<xsl:template match="official_title">
<span class="tealbold">Official Title: </span> <xsl:value-of select="normalize-space(.)" />
</xsl:template>
<xsl:template match="phase">
<span class="tealbold">Phase: </span> <xsl:value-of select="normalize-space(.)" />
</xsl:template>
<xsl:template match="overall_status">
<xsl:value-of select="normalize-space(.)" />
</xsl:template>
<xsl:template match="eligibility">
<xsl:param name="type" />
<xsl:choose>
<xsl:when test="$type = 'short'">
<span class="tealbold">Eligibility: </span> <xsl:call-template name="ages">
<xsl:with-param name="min"><xsl:value-of select="normalize-space(minimum_age)" /></xsl:with-param>
<xsl:with-param name="max"><xsl:value-of select="normalize-space(maximum_age)" /></xsl:with-param>
</xsl:call-template>, <xsl:apply-templates select='gender' />
</xsl:when>
<xsl:when test="$type = 'long'">
<span class="trialtitle">Eligibility: </span>
<span class="tealbold">Age: </span> <xsl:call-template name="ages">
<xsl:with-param name="min"><xsl:value-of select="normalize-space(minimum_age)" /></xsl:with-param>
<xsl:with-param name="max"><xsl:value-of select="normalize-space(maximum_age)" /></xsl:with-param>
</xsl:call-template>
<span class="tealbold">Genders Eligible for Study: </span> <xsl:apply-templates select='gender' />
<xsl:text>
</xsl:text>
<span class="tealbold">Eligibility Criteria: </span>
<xsl:apply-templates select='criteria/textblock' />
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="gender">
<xsl:choose>
<xsl:when test=". = 'Both'">Male or Female</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(.)" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="overall_contact">
<span class="trialtitle">Central Contact: </span>
<xsl:apply-templates select='./first_name' /><xsl:text> </xsl:text>
<xsl:apply-templates select='./middle_name' /><xsl:text> </xsl:text>
<xsl:apply-templates select='./last_name' />
<xsl:apply-templates select='./phone' />
<xsl:apply-templates select='./email' />
</xsl:template>
<xsl:template name="ages">
<xsl:param name="min" />
<xsl:param name="max" />
<xsl:choose>
<xsl:when test="($min != '') and ($max != '')">Between <xsl:value-of select="$min" /> and <xsl:value-of select="$max" /></xsl:when>
<xsl:when test="($min != '') and ($max = '')"><xsl:value-of select="$min" /> and Above</xsl:when>
<xsl:when test="($min = '') and ($max != '')">Under <xsl:value-of select="$max" /></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="brief_summary/textblock">
<span class="trialtitle">Trial Description: </span> <xsl:call-template name="substitute">
<xsl:with-param name="string" select="." />
</xsl:call-template>
</xsl:template>
<xsl:template name="location">
<span class="trialtitle"><xsl:apply-templates select='.//country' /><xsl:apply-templates select='.//state' /></span>
<xsl:apply-templates select='./facility/name' /><xsl:apply-templates select='.//city' /><xsl:apply-templates select='.//zip' /><xsl:apply-templates select='.//status' />
<xsl:apply-templates select='./contact' />
</xsl:template>
<xsl:template match="contact">
<span class="tealbold">Site Contact: </span>
<xsl:apply-templates select='first_name' />
<xsl:apply-templates select='middle_name' />
<xsl:apply-templates select='last_name' />
<xsl:apply-templates select='phone' />
<xsl:apply-templates select='email' />
</xsl:template>
<xsl:template match="criteria/textblock">
<xsl:call-template name="substitute">
<xsl:with-param name="string" select="." />
</xsl:call-template>
</xsl:template>
<xsl:template match="facility/name"><xsl:value-of select="normalize-space(.)" /></xsl:template>
<xsl:template match="country"><xsl:value-of select="normalize-space(.)" /></xsl:template>
<xsl:template match="city">, <xsl:value-of select="normalize-space(.)" /></xsl:template>
<xsl:template match="zip">, <xsl:value-of select="normalize-space(.)" /></xsl:template>
<xsl:template match="state">, <xsl:value-of select="normalize-space(.)" /></xsl:template>
<xsl:template match="status">, <xsl:value-of select="normalize-space(.)" /></xsl:template>
<xsl:template match="first_name"><xsl:value-of select="normalize-space(.)" /> </xsl:template>
<xsl:template match="middle_name"><xsl:value-of select="normalize-space(.)" /> </xsl:template>
<xsl:template match="last_name"><xsl:value-of select="normalize-space(.)" /></xsl:template>
<xsl:template match="phone">Phone: <xsl:value-of select="normalize-space(.)" />
</xsl:template>
<xsl:template match="email"><xsl:if test='. != ""'>EMail: <xsl:value-of select="normalize-space(.)" />
</xsl:if></xsl:template>
<xsl:template name="substitute">
<xsl:param name="string" />
<xsl:param name="from" select="'
'" />
<xsl:param name="to">
</xsl:param>
<xsl:choose>
<xsl:when test="contains($string, $from)">
<xsl:value-of select="substring-before($string, $from)" />
<xsl:copy-of select="$to" />
<xsl:call-template name="substitute">
<xsl:with-param name="string"
select="substring-after($string, $from)" />
<xsl:with-param name="from" select="$from" />
<xsl:with-param name="to" select="$to" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Please do as early as possible..
thanks in advanceHi I tried with below querry but iam getting an error message?
SQL> Insert into temp_clob_tab
2 SELECT XMLELEMENT("soap:Envelope",
3 XMLATTRIBUTES ('http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi",
4 'http://www.w3.org/2001/XMLSchema' as "xmlns:xsd",
5 'http://schemas.xmlsoap.org/soap/envelope/' as "xmlns:soap"),
6 XMLELEMENT("soap:Body"),XMLELEMENT("AddListing",
7 XMLATTRIBUTES ('http://www.christielites.com' as "xmlns" )),
8 XMLELEMENT ( "SCOMCODE",a.SCOMCODE), XMLELEMENT ( "SLOCCODE",SLOCCODE),
9 XMLELEMENT ( "DSTART",DSTART),XMLELEMENT ( "DEND",DEND),XMLELEMENT ( "SECODE",SECODE),
10 XMLELEMENT ( "IAVAIL",IAVAIL),XMLELEMENT ("IOWNED",IOWNED),XMLELEMENT ("SPOSTTRANS",SPOSTTRANS))
11 from LiteExchangeAvailablity a;
SELECT XMLELEMENT("soap:Envelope",
ERROR at line 2:
ORA-00932: inconsistent datatypes: expected CLOB got - -
Splitting comma seperated column data into multiple rows
Hi Gurus,
Please help me for solving below scenario. I have multiple value in single column with comma seperated values and my requirement is load that data into multiple rows.
Below is the example:
Source Data:
Product Size Stock
ABC X,XL,XXL,M,L,S 1,2,3,4,5,6
Target Data:
Product Size Stock
ABC X 1
ABC XL 2
ABC XXL 3
ABC M 4
ABC L 5
ABC S 6
Which transformation we need to use for getting this output?
Thanks in advance !Hello,
Do you need to do this tranformation through OWB mapping only? And can you please tell what type of source you are using? Is it a flat file or a table?
Thanks -
How to fetch single row data into multiple columns
Hi Have a cursor
which will have SELECT Sun_hrs,Mon_hrs,Tue_hrs,Wed_hrs,Thu_hrs,Fri_hrs,Sat_hrs from OTMaster;
now my cursor has one row of the above columns with this row data I want to insert into other tale as column wise
ex:
my row is like this: Sun_hrs,Mon_hrs,Tue_hrs,Wed_hrs,Thu_hrs,Fri_hrs,Sat_hrs
01:00 01:00 01:00 01:00 01:00 01:00 01:00
now I want to insert the above data into table with loop along with weekday
weekday, OTHrs
1 01:00
2 01:00
3 01:00
4 01:00
5 01:00
6 01:00
7 01:00
which type of variable I need to fetch the records, rowtype or tabletype,
plz help methank you for information, and now I am using UNPIVOT below is my query
SELECT * FROM OTCEILINGMASTER
UNPIVOT(OTHOURS FOR WEEK_DAY IN (SUN_CEILING_HRS AS '1',MON_CEILING_HRS AS '2',TUE_CEILING_HRS AS '3',
WED_CEILING_HRS AS '4',THU_CEILING_HRS AS '5',FRI_CEILING_HRS AS '6',SAT_CEILING_HRS AS '7'));
when I am selecting all the columns (select * from OTCEILINGMASTER) then only the above query is executing I want only two columns from the table however my table has 10 columns.
please looking into this -
Problem in loading of flat file transaction data into BI7
Hi Experts,
I am new to BI7, got in problem in creation of Data source.
I have fields in flat file are:
CUSTID,SREPID,MATID,PRICE PER UNIT,UNIT,QUANTITY,TRANS.DATE
one of the row under the above fields is
C100,SR100,MAT01, 50,CS,5,19991005
Created infoobjects are:
IO_CUSID
IO_SRID
IO_MATID
IO_PRC
IO_QTY
IO_REV
0CALDAY
IO_QTY was created with Unit/currency '0UNIT'
In creation of Data source, under field tab system shown extra CS field, I did confuse that which infoobject should be map to this field. At the same time i created IO_QTY with 0UNIT so when i entered IO_QTY under infoobjects column, system automatically created 0UNIT infoobject. I didn't completly understand why one of the unit (CS) sat under the fields column. could you clarify me please.
And also could you please tell me the procedure of creating transfer routine for sales revenue as we didn't have this object in flat file (SS). In earlier version of BW(Addison Wesley Step by Step book) i did this at infosource level. Here i am loading the data without infosource so just i would like to know is it possible to create transfer routine at DS level or do i need to create Infosource in this case. If it is the case also could you please make me understand with procedure to create transfer routine for sales revenue.
Your solutions will be more appreciated with points.
Thank you,
ShriHi,
1.Open Administrator Workbench: Modeling, from the menu or using the transaction RSA1
2.Go to Source Systems (File)and Create a new System.
3. Double click on the datasources, create data source
4.Entitle the Datasource, choose Transaction Data as Data Type Datasource
5. In next screen, Go to Extraction , Activate the data source
6.Go to Preview. Press Read Preview Data.
7.Data will be loaded: Save and activate the datasource
8.Go to InfoProvider, go to Info area and create Infocube
9.Entitle the infocube, press create
10.Display all info objects: . Choose your info objects , Move the characteristics and key figure to the infocube by drag and drop adn activate
11.Go to InfoCube, create transformation
12.Click on the Show Navigator button. Match the fields in navigator. Save and activate.
13.go to info provider, your info cube, create data transfer process
14.Choose: Extraction Mode: full
Update: Valid records update, Reporting possible (Request green)
Activate, execute
14.Double click on the data source, Read Preview Data
15.Create an InfoPackage by right clicking on the datasource. Execute the load into PSA.
16.Verify data was loaded into PSA before proceeding with the next step.
17. Execute the Data Transfer Process
18.Monitor the results (Menu: GoTo: DTP Monitor)
19.Try to display the data at the BW Frontend.
Thanks,
Sankar M -
How can split data into multiple sheets using an excel template
Hi all,
I'm using BIP 10.1.3.4.1 upgrated with the latest rollup patch, 9546699.
I followed the example inside the article "Real Excel Templates 1.5" (on the Tim Dexter's blog)
http://blogs.oracle.com/xmlpublisher/2010/05/real_excel_templates_i.html
and I built my report directly from an excel template containing only one sheet (plus the XDO_METADATA sheet), and for one sheet it worked fine !!!
Now I need to add more sheets to the template.... and I have two big questions:
1. if I need to create a second sheet which contains almost the same data (with a different layout), I saw that it is not possible to map a value to more than 1 cell....so if I map a value in the first sheet, I can't map it in the second sheet (because it's already used in the first one).
How can I map same values into two or different execll
2. if I need to create a second sheet which contains another dataset (completely different from the dataset in the first sheet), I can I do, considering that every BIP report is based on ONLY a data source.
Tim wrote: The most impressive, for me at least, is the sheet 'bursting'. You can split your hierarchical data across multiple sheets and dynamically name those sheets
but I didn't yet understand how this bursting it's possible.....considering what I said above.....
Surely I've a lack of knowledge.....but anybody can help me to understanding the "multiple excel sheets" black hole ?
I'll appreciate any kind of help
Thanks in advance
AlexYou can find working solution here http://xlspe.com
-
Loading data into multiple tables using sqlloader
Hi,
I am using sql loader to load the data from flat file into the data base
my file structure is as below
====================
101,john,mobile@@fax@@home@@office@@email,1234@@3425@@1232@@2345@@[email protected],1234.40
102,smith,mobile@@fax@@home,1234@@345@@234,123.40
103,adams,fax@@mobile@@office@@others,1234@@1233@@1234@@3456,2345.40
in file first columns are empno,ename,comm_mode(multiple values terminated by '@@'),comm_no_txt(multiple values terminated by '@@'), sal
the comm_mode and comm_no_text needs to be inserted into the separate table (emp_comm) like below
emp
empno ename sal
101 john 1234.40
102 smith 123.40
103 adams 2345.40
emp_comm
empno comm_mode comm_no_text
101 mobile 1234
101 fax 3425
101 home 1232
101 office 2345
101 email [email protected]
102 mobile 1234
102 fax 345
102 home 234
103 fax 1234
like this needs to insert the data using sql loader
my table structures
===============
emp
empno number(5)
ename varchar2(15)
sal number(10,2)
emp_comm
empno number(5) reference the empno of the emp table
comm_mode varchar2(10)
Comm_no_text varchar2(35)
now i want insert the file data into the specified structues
please help me out to achieve this using sql loader
(we are not using external tables for this)
Thanks & Regards.
Bala Sake
Edited by: 954925 on Aug 25, 2012 12:24 AMPl post OS and database details
You will need to split up the datafile in order to load into separate tables. The process is documented
http://docs.oracle.com/cd/E11882_01/server.112/e22490/ldr_control_file.htm#autoId72
HTH
Srini -
Hi,
I am trying to extract data from multiple CSV files to SQL into a single table. The data type of all the columns in SQL table is nvarchar(MAX). I am able to extract the data from the flat files but some of the data(on extraction) is
corrupt including question marks(?) and other invalid special characters. Also I tried selecting the UTF-8, 65001(Unicode) format but the problem still persists. Also I tried using data converter but no use.
I checked with the data in the flat file but there is no data with question mark(?) or any other special characters.
The separator in the flat file is Comma(,)
Please help.
Thanks in advace.The source system and application determines the code page and encoding. Is it Windows, Unix, Mainframe or some other type?
Unicode files sometimes begin with a byte order mark (2 bytes) to indicate little or big endian. If you open the file in notepad and then select save as, the encoding in the dialog will show the encoding notepad detected based on the BOM. If
that is ANSI instead of Unicode or UTF-8, you will need to know the code page the source system used when the file was created.
Dan Guzman, SQL Server MVP, http://www.dbdelta.com -
Sorting data into multiple columns
Hello, I'm trying to create an array that I can output to a spreadsheet file. I'm sampling based on time, and I'm doing some data analysis within the program. I want to format the array to be like this:
| Current time | Airflow | Volume | x | y | z |
and have this for each time point. I can do this with a single signal but I'm having issues with the multiple data entries. The time is controlled by an input to the timed structures palette.
Here's a screencap of what I have. I'll be adding more signals to the output as I go. I'll also include the VI.
Thank you!
Attachments:
sensor display.vi 102 KBWhat I would do is create a typedef cluster containing the data that you know you will want to write for each update. In this case, you will create a cluster with a timestamp control in it and two floats - for the three values you know about now. Do not forget to label the controls for what they will contain.
VERY IMPORTANT: After creating this cluster, save it as a typedef!!!
Now create a VI that takes that cluster as an input. Inside that VI, format the data from the cluster into a tab-delimited string and append it to the end of a file.
Finally, bundle the three values that you have now and wire it to the cluster input of the VI you just created. Now as you add new values that you will want to save, you will need to add them to the typedef, add the formatting code inside the subVI, and add the value to the input cluster.
Mike...
As an exercise for the reader:
You will probabliy also want to add some mechanism to your data saving VI to:
Allow you to specify the path of the file to which you want to write,
Handle/report errors
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
Error while loading data into Oracle db using SSIS
Hi,
Can somebody help regarding the following error message:
Message
Error: 2013-07-21 03:23:50.76 Code: 0xC0202009 Source: Data Flow Task 25 Destination 121 - BUSINESSFLOWLOG 1 [466] Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "OraOLEDB" Hresult: 0x80004005 Description: "ROW-00060: Internal error: [dainsert,16]`? ". End Error Error: 2013-07-21 03:23:50.76 Code: 0xC0209029 Source: Data Flow Task 25 Destination 121 - BUSINESSFLOWLOG 1 [466] Description: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "Destination Input" (479)" failed because error code 0xC020907B occurred, and the error row disposition on "input "Destination Input" (479)" 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. End Error Error: 2013-07-21 03:23:50.76 Code: 0xC0047022 Source: Data Flow Task 25 SSIS.Pipeline Description: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination 121 - BUSINESSFLOWLOG 1" (466) failed with error code 0xC0209029 while processing input "Destination Input" (479). 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. End Error Error: 2013-07-21 03:23:50.78 Code: 0xC02020C4 Source: Data Flow Task 25 Source 121 - BUSINESSFLOWLOG 1 [511] Description: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020. End Error Error: 2013-07-21 03:23:50.78 Code: 0xC0047038 Source: Data Flow Task 25 SSIS.Pipeline Description: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "Source 121 - BUSINESSFLOWLOG 1" (511) returned error code 0xC02020C4. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 03:00 Finished: 03:23 Elapsed: 1431.06 seconds. The package execution failed. The step failed.
THANKS.I don't see any Oracle related error.
Consider posting this on any SSIS forum -
Insert data into multiple tables
Hi all,
I've a requirement where i need to insert data into multiple tables using PL/SQL procedure
Procedure should have two parameters
1. Table Name (parameter1)
2. Data (parameter2)
Based on these two parameters i need to insert data into table (parameter1) using data (parameter2)
ex:
Procedure insert_data (p_table IN VARCHAR2
,p_data IN -- what should be the datatype?
IS
l_statement VARCHAR2(2000);
BEGIN
-- insert data into tables
INSERT INTO p_table
values (....);
END insert_data;Thanks in advance!!BEDE wrote:
Amen to that!
So, I believe a better approach would be the following...
Suppose you have N datafiles with the same structure, and you wish to insert into the database the data from all those files.
For that, you should have a single table, named, say incoming_file_data, which should be structured more or less like below:
create table incoming_file_data (
filename varchar2(250) not null -- name of the file inserted from
,file_time timestamp -- timestamp when the data was inserted
,... -- the columns of meaningful data contained in the lines of those files
);And you will insert the data from all those files in this table, having normally one transaction for each file processed, for otherwise, when shit happens, some file may only get to be partially inserted into the table...
Maybe one good approach would be to create dynamically an external table for the file to be loaded, and then execute dynamically insert select into the table I said, so that you will have only one insert select for one file instead of using utl_file... RTM on that.If the file structures are the same, and it's just the filename that's changing, I would have a single external table definition, and use the alter table ... location ... statement (through execute immediate) to change the filename(s) as appropriate before querying the data. Of course that's not scalable if there are multiple users intenting to use this, but generally when we talk about importing multiple files, it's a one-user/one-off/once-a-day type of scenario, so multi-user isn't a consideration. -
Split one row into multiple columns
Hi,
Data in one CLOB column in a table storing with delimiter, ##~~##. Ex. ##~~##abc##~~##defgh##~~##ijklm##~~##nopqr (data starts with delimiter). Please help me to split the data into multiple rows like below and it should be in the same order.
abc
defgh
ijklm
nopqr
I am using Oracle 11g.
Thanks.Thanks Hoek for your response. Before posting my question in the forum, I tried similar query. It is working with one character as delimiter.
with test as (select 'ABC,DEF,GHI,JKL,MNO' str from dual )
select regexp_substr (str, '[^,]+', 1, rownum) split
from test
connect by level <= length (regexp_replace (str, '[^,]+')) + 1;
Above query is giving correct result by fetching 5 rows. I have modified the query like below...
with test as (select 'ABC,,,DEF,,,GHI,,,JKL,,,MNO' str from dual )
select regexp_substr (str, '[^,,,]+', 1, rownum) split
from test
connect by level <= length (regexp_replace (str, '[^,,,]+')) + 1;
Above query resulting 13 rows and last 8 rows are nulls. Number of null rows are increasing, if I increase number of characters in delimiter. Could you please tell me how to avoid those null rows.
Thanks. -
Displaying data from multiple columns into a single line graph
Post Author: hollowmatrix
CA Forum: WebIntelligence Reporting
Hey,I have an issue with the WEBI reporting.I have a data source that has multiple columns say ( month1, month2, month3, month4,.....month 12, month 13, ....month24) with the sales data for each month.Now say I call the month 1 to month 12 as "current year", and call month 13 - month 24 as "previous year".I want to put a prompt in the report which allows me to select between "current year" and "previous year".Based on the prompt value we get a graph of the sales vs month ....as in if we select "current year", then we get a graph of the sales Vs time( remember that the sales data for each month is in a different column.)and if we select "previous year" then we get a graph of the sales Vs time for previous year..( sales vs time for Month 13, month 14, month 15....month 24).I am not able to pull data from multiple columns into a single object that I can use to populate the graphs.Any help on the same will be appreciated .Hi,
<p>
please click
here (asktom) and look for the words "how about the other way round"
</p> -
Split one column value and insert into multiple columns
hi
am new to plsql .
i want to split a characters from one column and insert into multiple columns
i tried used substr function the symbol ',' vary his place dynamically ,so i can't apply substr function.
for eg: before split
col1 :
col2 :
col3 :
col4 :
colu5: adsdf,fgrty,erfth,oiunth,okujt
after split
col1 :adsd
col2 :fgrty
col3 :erfth
col4 :oiunth
col5 : adsdf,fgrty,erfth,oiunth,okujt
can anyone help me
thanks
Edited by: 800324 on Dec 23, 2010 8:28 AM
Edited by: 800324 on Dec 23, 2010 8:36 AMHow about:
SQL> create table t
2 (col1 varchar2(30)
3 ,col2 varchar2(30)
4 ,col3 varchar2(30)
5 ,col4 varchar2(30)
6 ,col5 varchar2(30)
7 );
Table created.
SQL> insert into t (col5) values ('adsdf,fgrty,erfth,oiunth,okujt');
1 row created.
SQL> insert into t (col5) values ('x,y');
1 row created.
SQL> insert into t (col5) values ('a,b,c,d');
1 row created.
SQL> select * from t;
COL1 COL2 COL3 COL4 COL5
adsdf,fgrty,erfth,oiunth,okujt
x,y
a,b,c,d
3 rows selected.
SQL>
SQL> merge into t a
2 using ( with t1 as ( select col5||',' col5
3 from t
4 )
5 select substr(col5, 1, instr(col5, ',', 1, 1)-1) col1
6 , substr(col5, instr(col5, ',', 1, 1)+1, instr(col5, ',', 1, 2)- instr(col5, ',', 1, 1)-1) col2
7 , substr(col5, instr(col5, ',', 1, 2)+1, instr(col5, ',', 1, 3)- instr(col5, ',', 1, 2)-1) col3
8 , substr(col5, instr(col5, ',', 1, 3)+1, instr(col5, ',', 1, 4)- instr(col5, ',', 1, 3)-1) col4
9 , rtrim(col5, ',') col5
10 from t1
11 ) b
12 on ( a.col5 = b.col5 )
13 when matched then update set a.col1 = b.col1
14 , a.col2 = b.col2
15 , a.col3 = b.col3
16 , a.col4 = b.col4
17 when not matched then insert (a.col1) values (null);
3 rows merged.
SQL> select * from t;
COL1 COL2 COL3 COL4 COL5
adsdf fgrty erfth oiunth adsdf,fgrty,erfth,oiunth,okujt
x y x,y
a b c d a,b,c,d
3 rows selected.
SQL> Assuming you're on 9i... -
How can I separate one column into multiple column?
How can I separate one column into multiple column?
This is what I have:
BUYER_ID ATTRIBUTE_NAME ATTRIBUTE_VALUE
0001 PHONE_NUMBER 555-555-0001
0001 EMAIL [email protected]
0001 CURRENCY USD
0002 PHONE_NUMBER 555-555-0002
0002 EMAIL [email protected]
0002 CURRENCY USD
0003 PHONE_NUMBER 555-555-0003
0003 EMAIL [email protected]
0003 CURRENCY CAD
This is what I would like to have:
BUYER_ID PHONE_NUMBER EMAIL CURRENCY
0001 555-555-0001 [email protected] USD
0002 555-555-0002 [email protected] USD
0003 555-555-0003 [email protected] CAD
Any help would be greatly appreciated.This is another solution. Suppose your actual table's name is test(which has the redundant data). create a table like this:
CREATE TABLE test2 (BUYER_ID number(10),PHONE_NUMBER varchar2(50),EMAIL varchar2(50),CURRENCY varchar2(50));
then you will type this procedure:
declare
phone_number_v varchar2(50);
EMAIL_v varchar2(50);
CURRENCY_v varchar2(50);
cursor my_test is select * from test;
begin
for my_test_curs in my_test loop
select ATTRIBUTE_VALUE INTO phone_number_v from test
where person_id=my_test_curs.person_id
and attribute_name ='PHONE_NUMBER';
select ATTRIBUTE_VALUE INTO EMAIL_v from test
where person_id=my_test_curs.person_id
and attribute_name ='EMAIL';
select ATTRIBUTE_VALUE INTO CURRENCY_v from test
where person_id=my_test_curs.person_id
and attribute_name ='CURRENCY';
INSERT INTO test2
VALUES (my_test_curs.person_id,phone_number_v,EMAIL_v,CURRENCY_v);
END LOOP;
END;
Then you will create your final table like this:
create table final_table as select * from test2 where 1=2;
After that write this code:
INSERT ALL
into final_table
SELECT DISTINCT(BUYER_ID),PHONE_NUMBER,EMAIL,CURRENCY
FROM TEST2;
If you have a huge amount of data in your original table this solution may take a long time to do what you need.
Maybe you are looking for
-
Hello all, I have an interesting client requirement regarding PI caching datasets which it can query in order to minimize amount of hits to the SAP database. These datasets would be refreshes in a specified batch. For example, there is a requirement
-
Receiving and/or sending photos by text
I just got the new Iphone and someone was trying to text a photo to me. Is this possible? I also used to text photos on my Razr phone very easily is this not a feature on this Iphone?
-
Incoming Mail on Lockscreen iphone 5
Hi My iPhone 5 does not ring on the Lockscreen when E Mails arrive, it wll only ring when I open the Mail Inbox. To me all settings look ok. Thanks.
-
How to insert a logo in a photo?
Sorry for the newbie question, I'm new to Photoshop but I need to put a logo (.gif) on some photos that will be on a web page? Can somebody be kind enough to tell me how I do that in Photoshop CS5?
-
Usingbestanonymousbrowser,all web sites"take too long, or timed out"
dear friends, have ff 4 beta, as defalt browser.windows 7 prem 64 bit.dial up connection.mcafee security center.ff and best anonymousbrowser, are given full program access through mcafee security.only when trying to use best anonymousbrowser, ff will