|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, March 10, 2011 11:54 PM
Points: 2,
Visits: 17
|
|
Hi All;
I'd like to copy a part of records in Oracle DB to SQL Server 2000 with DTS. DTS's Steps are...
1. Run Execute SQL Task to retrieve the data and output to GV with RecrodSet Type. SELECT col1 FROM TableA --> Lists (RecordSet) !! some records are return as result !!
2. Run ActiveX Script Task to change data type from RecordSet to String and output to GV with Lists_for_Query.
set objRS = CreateObject("ADODB.Recordset") set objRS = DTSGlobalVariables("Lists").value for cnt = 1 to objRS.RecordCount if strList = "" then strList = objRS.Fields("col1").value else strList = strList & ", " & objRS.Fields("col1").value end if objRS.MoveNext next DTSGlobalVariables("Lists_of_Query").value = strList
Lists_of_Query contains a string such as "1200, 1201, 2003"
3. Run Transform Data Task to copy a part of records in Oracle DB to SQL Server 2000 with following Query.
SELECT * FROM TableB WHERE (col2 IN (?) )
!! The type of col2 is Number(10) !!
When I run this DTS, I got "ORA-01722: invalid number" Error Message.
But I can run the following query in Oracle SQL Developer Toole.
SELECT * FROM TableB WHERE (col2 IN (1200, 1201, 2003) )
Do you have any idea?
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 2:27 PM
Points: 1,329,
Visits: 4,293
|
|
| where does the come from?
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, March 10, 2011 11:54 PM
Points: 2,
Visits: 17
|
|
Sorry. TableA is held by MSSQL Server. TableB is held by Oracle 10g.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 2:27 PM
Points: 1,329,
Visits: 4,293
|
|
I'm not familiar with DTS nor the "b" parameters.
I suspect that strList is passed as a string instead of a rowset/table. (for the in clause) Like in ('abc,ddfdfqd,dfdfqdfe')
You can resort to dynamic sql using sp_executesql (beware of sql-injection)
|
|
|
|