Transfer data from Result Set (Execute SQL Task) into Flat File
Hi to all,
My problem is this:
-) I have a stored procedure which use a temporary table in join with another "real" table in select statement. In particular the stored procedure look like this:
create table #tmp
col1 varchar(20),
col2 varchar(50)
--PUT SOME VALUE IN #TMP
insert into #tmp
values ('abc','xyz')
--SELECT SOME VALUE
select rt.*
from realTable rt, #tmp
where rt.col1 = #tmp.col1
-) I cannot modify the stored procedure because I'm not admin of database.
-) I HAVE THE REQUIREMENT OF TRANSFER DATA OF SELECT STATEMENT OF SOTRED PROCEDURE INTO FLAT FILE
-) THE PROBLEM is that if I use an OLEDB source Task within a Data Flow Task I'm not be able of mapping column from OLEDB source to flat file destination. The reason for this, is that in the "Column page" of OLEDB source task, SSIS do not retrieves
any column when we using a temporary table. The reason for this, is that SSIS is not be able to retrieve metadata related to temporary table.
-) One possible solution to this problem is to use an Execute SQL Task to invoke the stored procedure, store the result returned from stored procedure in a Result Set through a Object type user variable.
-) The problem now is: How to transfer data from result set to flat file?
-) Reading here on this forum the solution look be like to use a Script task to transfer data from result set to flat file.
QUESTIONS: How to transfer data from result set to flat file using a script task?? (I'm not an expert of vb .net) Is it really possible?? P.S.: The number of row returned of stored procedure is very high!
thanks in advance.
Hi Visakh16<abbr
class="affil"></abbr>
thanks for the response.
Your is a good Idea, but I do not have permission to use DDL statement on the database in production environment.
Similar Messages
-
Transfer data from Oracle 7 to SQL server 2005
Hello guys,
I am new in Oracle and I need some help from you:
I have an Oracle database 7 and I need to transfer some tables into MS SQL Server 2005.
Is there any ORACLE utility (compatible with ver 7) to help me in this task?
If not, what is the way to trasfer data from a Oracle database 7 to SQL Server 2005?
Thank in advanceSQL Server can access Oracle database via the Linked Database feature however I do not know if you could find a Oracle 7 database compatiable Oracle client to use with a SQL Server 2005 database. i would not even try to configure this.
What I suggest is you use SQLPlus to spool out delimited data into flat files, copy/FTP etc ... those flat files to your SQL Server box, and use BCP to load the data into SQL Server.
There have been numberous posts of generating delimited flat files from Oracle data posted here on the forum but here is one method that will work on version 7:
How do I export a database table to a flat file ?
http://www.jlcomp.demon.co.uk/faq/flatfile.html
HTH -- Mark D Powell -- -
TRANSFER DATA FROM MS-SQL SERVER TO ORACLE
hello everybody
can anyone tell me how 2 transfer or convert data from ms-sql server to oracle
is there any utility
if yes let me know .
thanks in advanceThere are various options depending on how much data we're talking about, where you want the program logic, whether it's a one-time migration, etc.
Among the options
- Use SQL Server's DTS
- BCP the data from SQL Server into flat files and use SQL*Loader to load it
- Create a database link using Heterogeneous Services and Generic Connectivity to extract data from SQL Server
- Use the Oracle Migration Workbench, which is now integrated into SQL Developer
- Use an ETL tool like Oracle Warehouse Builder
Justin -
Put some data form the databse of SQL Server into SAP and auto general PR?
Dear all,
Can you tell me how I can put some data from the databse of SQL Server into SAP and auto general PR?
Best regards,
Merryzhang
Edited by: merry zhang on Feb 4, 2009 9:10 AMHi Zhang,
If i have understood your question properly, I guess you wanted to create Purchase Requistion automatically right?
Then you have lots of option simpilest one would be create a couple of Z table with all the fields that you require for header and Item.
create a Program and use BAPI function module to create the PR by reading the values from those Z tables. after creation delete the contents from the table. Schedule this program in Background periodically like everyday or weekly once however you would like it to be. So once the table has contents in it and when the program runs it will create the PR's (Purchase Requisition).
You can also use a workflow with the Z table. Once the Z table is filled you can trigger a workflow based on the Table change. I'm not sure like how to do it but I nkow that this process can also be used.
Hope this might have thrown some light upon.
Thanks,
Prashanth -
Execute SQL Task does not Update from a Date Variable Reliably
I'm using a DateTime variable in SSIS 2008 that is used to set the SQLStatement property of an Execute SQL Task.
"DELETE FROM Labor WHERE Week = '" + (DT_WSTR, 100) @[User::Week] + "'"
Week is the next Sunday:
DATEADD( "day", @[User::DaysTillSunday] , @[User::TheDayThatIsTwentyMinutesPrior] )
DaysTillSunday:
DATEPART( "dw", @[User::TheDayThatIsTwentyMinutesPrior] ) == 1 ? 0 : 8 - DATEPART( "dw", @[User::TheDayThatIsTwentyMinutesPrior] )
TheDayThatIsTwentyMinutesPrior:
(DT_DATE)(DT_DBDATE)DATEADD("minute",-20,GETDATE())
The SSIS Package deletes the current week's data, reloads it with fresh data, then calculates the difference between the current week and last week.
The problem is that randomly, instead of deleting the current week, it will delete the previous week. This happens maybe 5-10% of the time. At least it does until I rebuild the package and import it into SQL Server again.
I'm guessing that the Execute SQL Task is not updating the value of the Week variable before it executes. I started with the source type being a variable. Then I decided to try Direct input and pass in the Week as a parameter (OLE DB Connection
Type). That didn't work either.
Most recently I tried writing the Week variable to a table first, then having a sequence container with all the tasks second. Slightly better but I still saw the date was wrong 2 times in about 90 executions. I was hoping that writing the Week
variable out to the database would force an update of any associated connections to it, but that didn't seem to work.
Any ideas? Is this a known issue, am I missing a setting?
thanks,
JohnJohn, computers either work all the time or have a bug. I suspect it is the latter.
To find it [faster] you need to log what the resulting expression was used in the package.
I am baffled how rebuilding a package would fix anything like setting a date.
It might be even dependant on when you run the package.
Why
DATEADD("minute",-20,GETDATE())
DATEADD( "day", -8 , GETDATE() )
It must be enough to set the week (that appears to be a date) as above.
Arthur
MyBlog
Twitter -
Execute SQL Task with Parameter - from DB2 to SQL Server
I am pulling data from DB2 to SQL Server.
1st Execute SQL task runs the following against DB2:
SELECT TIMESTAMP(CHAR(CURRENT_DATE - (DAY(CURRENT_DATE)-1) DAYS - 1 MONTH)) as START_MONTH
FROM SYSIBM.SYSDUMMY1;
I'm storing it as a Result Set.
Next I have a Data Flow Task. This pulls data from DB2 where the date matches the parameter.
FROM SCHEMA.TABLE t
WHERE DATE_TIME_COLUMN= ?
This works fine. Guessing, because the parameter source is DB2 and the Data Flow source is DB2.
The problem is, I want to remove existing data for the same date in the SQL table. IE, if I'm pulling March 2014 data from DB2, I want to be sure there is no March 2014 data in the SQL table. The main use is for re-runs.
So, I added another Execute SQL task after the first one that assigns the variable, and before the Data Flow Task. This runs the following statement against SQL Server:
DELETE FROM
database.dbo.table
WHERE DATE_TIME_FIELD >= ?
The package fails at the new Execute SQL Task with the following error message:
Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "DELETE FROM
SBO.dbo.tblHE_MSP_FEE_BUCKETS
WHERE T..." failed with the following error: "Parameter name is unrecognized.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established
correctly.
Task failed: Execute SQL Task
SSIS package "Load_MSP_Fee_Buckets_SQL.dtsx" finished: Success.
The program '[14240] Load_MSP_Fee_Buckets_SQL.dtsx: DTS' has exited with code 0 (0x0).
I am assuming this is something to do with the Parameter source being DB2, and trying to use against SQL?
Any suggestions on how to make this work??
Thanks,
-Al HParameter name is unrecognized
is the key, how come DB2 is related if it runs against SQL Server
What I think is happening you do not use the OLEDB connection to SQL Server.
Likewise, if it is ADO then the query needs to be
DELETE FROM
database.dbo.table
WHERE DATE_TIME_FIELD >= @MyDate
Arthur My Blog -
How to export the result from executing sql statement to excel file ?
HI all,
Great with Oracle SQL Developer, but I have have a trouble as follwing :
I want to export the result from executing sql statement to excel file . I do easily like that in TOAD ,
anyone can help me to do that ? Thanks so much
SigmasvnHello Sue,
I just tried to export to excel with the esdev extension and got java.lang.NumberFormatException. I found the workaround at Re: Windows Multi-language env, - how do I set English for application lang?
open the file sqldeveloper\jdev\bin\sqldeveloper.conf and add the following two lines:
AddVMOption -Duser.language=en
AddVMOption -Duser.country=USyet now my date formats in excel are 'american-style' instead of german. For example 01-DEC-01 so excel does not recognize it as date and therefore I can not simply change the format.
When export to excel will be native to 1.1 perhaps someone can have a look at this 'feature'
Regards
Marcus -
Execute SQL Task - UPDATE or Data Flow Data Conversion
Good Morning folks,
I want to know which is more fast to convert data type.
I want to convert nvarchar(255) to datetime2,
using t-sql (execute sql task)
UPDATE TBL
SET FIELD1= CAST(FIELD1AS DATETIME2)
GO
or data conversion(data flow)
Thank..Itz Shailesh, my t-sql have only UPDATE, not many UPDATES... so it's one batch, no 2,3,4... So.. it's Only one update.. ex: update table set field1 = cast(field1 as datetime2), field2 = cast(field2 as datetime2). not : update table set field = cast(field
as datetime2) go update table set field2 = cast(field2 as datetime2) go.... understand?
Yeah, I understand that you have to update just 1 field. What I am saying, if you have to update millions of rows then you must update rows in batches ( lets say batch of 50k). This way you will only touch 50k rows at a time and not all rows from table.
I see that your rows are less however I would still prefer the option of data conversion transformation over update statement.
If this post answers your query, please click "Mark As Answer" or "Vote as Helpful". -
Transfer data from SAP TABLES to a SQL table
Hi,
I need to transfer data from SAP tables to a SQL table. Please suggest the best way as well as the steps please.
Regards,
KamleshHi
Step 1: Create an entry for the External database in DBCON table using Trxn: DBCA.
Field Name Description Value (For: E.g.:)
CON_NAME Logical name
for database con RAJ
DBMS Database system MSS
USER_NAME Database user <username>
PASSWORD Password for setting up
the connection
to the database <pwd>/<pwd>
CON_ENV Database-specific MSSQL_SERVER=depotserver MSSQL_DBNAME=HOF_INDORE
DB_RECO Availability type for an open database connect
Then, you can define internal table and code the following way:
DATA: BEGIN OF wa,
c_locid(3),
c_locname(50),
c_locstate(5),
END OF wa.
EXEC SQL.
CONNECT TO 'RAJ' AS 'V'
ENDEXEC.
EXEC SQL.
SET CONNECTION 'V'
ENDEXEC.
< Populate SAP data into an internal table >
Loop on itab.
EXEC SQL.
< code here for populating data into MS-SQL Server table>
ENDEXEC.
Endloop.
Regards,
Raj -
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 meWhat 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] -
Hi,
How do I return two values from a
stored procedure into an "Execute SQL Task" please? Each of these two values need to be populated into an SSIS variable for later processing, e.g. StartDate and EndDate.
Thinking about stored procedure output parameters for example. Is there anything special I need to bear in mind to ensure that the SSIS variables are populated with the updated stored procedure output parameter values?
Something like ?
CREATE PROCEDURE [etl].[ConvertPeriodToStartAndEndDate]
@intPeriod INT,
@strPeriod_Length NVARCHAR(1),
@dtStart NVARCHAR(8) OUTPUT,
@dtEnd NVARCHAR(8) OUTPUT
AS
then within the SSIS component; -
Kind Regards,
Kieran.
Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/Below execute statement should work along the parameter mapping which you have provided. Also try specifying the parameter size property as default.
Exec [etl].[ConvertPeriodToStartAndEndDate] ?,?,? output, ? output
Add a script task to check ssis variables values using,
Msgbox(Dts.Variables("User::strExtractStartDate").Value)
Do not forget to add the property "readOnlyVariables" as strExtractStartDate variable to check for only one variable.
Regards, RSingh -
Transfer data from two oracle version to one sql server 2005
Hi,
I have two database servers on different machines. They are
1) Oracle 8.1.7.4
2) Oracle 7.3.1.4
I have to create agents which can transfer tables from these two databases to one machine having sql server 2005 database.
Please tell me what are the options. What drivers i need to install on machine having sql server 2005 so that i can transfer data from both oracle versions.
Thanks
Rajneesh.Your Oracle databases are so old you might want to look around and see if you can find dinosaur bones near by.
Given the differences in data types between Oracle and SQL Server I'd suggest you start off by dumping the data into delimited ASCII files and then loading it using whichever SQL Server tool you wish. -
Connect & transfer data from SQL Server Database
Hi all,
I would like to connect to MS SQL Server Database and transfer data from the data stored in the SQL Server Database tables into Oracle Tables.
How should I go about doing this ?
P.S.: I am using Oracle 11g and SQL Server 2005
Message was edited by:
MonkWhat operating system is your Oracle database running on?
If you're running Oracle on Windows, you can use Heterogeneous Services and Generic Connectivity along with the Microsoft SQL Server ODBC driver to create a database link from Oracle to SQL Server. If you're running Oracle on something other than Windows, you can do the same thing, but you would generally need to license either a third party ODBC driver or one of the Oracle Transparent Gateway products.
Justin -
Transfer data from 2 oracle version to sql server 2005
Hi,
I have two database servers on different machines. They are
1) Oracle 8.1.7.4
2) Oracle 7.3.1.4
I have to create agents which can transfer tables from these two databases to one machine having sql server 2005 database.
Please tell me what are the options. What drivers i need to install on machine having sql server 2005 so that i can transfer data from both oracle versions.
Thanks
Rajneesh.You could create a linked server. Install the Oracle client on the server with SQL Server 2005, setup the TNS to your Oracle databases, create the linked server and then grab the data that way. There are migration tools as well but if the database is small in size I found linked servers to work and give me better control over the migration. This assumes that the database is not very large. If it is really large a migration tool might be a better option.
-
Why is my Package just stopping when going from one Execute SQL Task to another Execute SQL Task
I have one flow constraint going for my one Execute SQL Task to another Execute SQL Task. It's executing #1 and successfully and just stops there rather than continuing on to Execute SQL Task #2. Why would it just stop? My constraint is NOT conditional...just
a straight ole flow constraint.
Any help is greatly appreciated and Thanks in Advance for your help.
PSULionRPHi PSULionRP,
First make sure the color of the Precedence Constraint is green (Success) or blue (Completion) other than red (Failure). Then, make sure the Execute SQL Task is not disabled (right click the executable, and “Disable” option is available in the right-click
menu).
Regards,
Mike Yin
TechNet Community Support
Maybe you are looking for
-
While Windows.Current.Bounds returns the application windows size, in order to create a full-screen bitmap my app would need to retrieve the full display area of the device. I cannot even get the aspect ratio. Pre-Win10, using Windows.Current.Bounds
-
can some one help me with the question ..
-
Hello, I'm trying to make a mirror for my c drive on which my Windows server 2008 is installed and running. When I try to convert it into a dynamic disk, it shows some warning that the operating systems installed on it might not work properly. What s
-
Date Format in DD-MM-YYYY in Module Pool
Hi, How can I show date in DD-MM-YYYY Format in Module Pool Thanks
-
Lightroom 4.2: Wrong time in map module
In Lightroom 4.2 I use the map module in the following way: 1. Load a gpx-Track 2. Select one or all tracks 3. Select the photos to be tagged 4. Select the correct time zone shift (normally the time interval of the track contains the time interval of