Ask: Implementing Stored Procedure In SSIS
Jan 8, 2008
Hi all,
I need to know whether changing/migrating process in SP to SSIS is a good idea to enhance performance in datawarehouse.
My client want to do this because they have problems in performance while executing SP from dts 2000 packages.
So they don't want to use SP anymore. They want to use all SSIS features.
Since I'm newby with SSIS, I don't have any idea how to implement SPs in SSIS, especially while working with temporary
tables.
Btw, this is snippet of the SP I want to change :
ALTER PROCEDURE [dbo].[DBAS_BBCBG_DataDaily]
@CustomDate datetime = null
AS
BEGIN -- Begin Procedure-
--15 Minute
DECLARE @date datetime
SET @date = isnull(@CustomDate,
(SELECT top 1 Reporting_Date From DBDS..DataDate))
SELECT * INTO #TbDataDaily FROM DBABC.dbo.TbDataDaily WHERE 1=2
BEGIN
INSERT INTO #TbDataDaily (
Col1, Col2, Col3, Col4, ValDate
)
SELECT CD1,CD2,CD3, CD4, @date
FROM DBAS..HDKFS
CREATE INDEX IDX_ABC_DataDaily ON
#ABC_DataDaily (Col3,Col4) ON [PRIMARY]
END
BEGIN
UPDATE #TbDataDaily
SET Col2 = B.CABLVT
FROM #TbDataDaily A, DBAS..COLACBFP B
WHERE A.Col3 = B.CAKNTN
END
... and so on...
all other processes in the SP are just about to SELECT/INSERT/UPDATE temporary table, and finally
fill the data to physical table.
So how can I change this SP to SSIS package? (of course if this is the best way to improve performance)
Thank You in advance.
Best Regards,
Ricky Lie
View 5 Replies
ADVERTISEMENT
Mar 19, 2007
Hi All,
I am using store procedure to which we pass ...
1.Sql query (String)
2.Starting index (Integer)
3.Page size (Integer)
4.total records out (Integer)
It works fine for the simple queries like "select * from tblcountry" but give error in case when we have sort of inline query or order clause or some complex query etc.
Despite of what is happing in the procedure can any help me out with a simple store procedure to which i give any query , start index and page size it should give me record set according to the given page.
For example query could be 'Select * from tblcountry where countryid in (select * from tblteachers) order by countryname desc', start index=0 , page size is 100 and total records are 500.
Note:
When i pass this query to sql server directly using command object its exectued successfully (this mean that it will also run fine in query analyzer), but i want to use paging in sql server so that is why i need a procedure to implement paging and query could be any its fully dynamic but i will be a valid query.
Your help in this regard is realy apperciated...
View 10 Replies
View Related
Dec 16, 2007
Hi all,
I am having a simple ssis package. In that i have an sql task that will insert a record in to the database. i find that if i use a simple OLEDB connection it works fine. but the problem comes here when i change the connection string with an valiable. Once i assign the same connection string to a valiable and assign the variable as expression, there after i encounter the following error.
[Execute SQL Task] Error: Failed to acquire connection "DB connection". Connection may not be configured correctly or you may not have the right permissions on this connection.
I am struggling with this for a long time.
Any of you plz suggest me a solution for this problem
Thankz
View 2 Replies
View Related
Jun 30, 2006
I have a simple SSIS package with three "Execute SQL Tasks". I am using ADO.Net Connection to execute SPs on a DB server.
When I execute this package It works fine. So far so good.
Now, I need to implement transation on this package. And problem starts now onwards. When I try to execute package after setting TransationOption = Required for the Sequence container which contains all the tasks, I get following error.
[Execute SQL Task] Error: Failed to acquire connection "NYCDB0008.Export". Connection may not be configured correctly or you may not have the right permissions on this connection.
"NYCDB0008.Export" is the name of the ADO.Net connection. I have been hunting for any solution but all in vain. I have tried changing all DTC settings on the dev as well as Database server.
Please respond if anyone has any solution.
Thanks!
Anand
View 24 Replies
View Related
Nov 21, 2007
I am trying to execute a stored procedure that runs a SSIS package. This package imports a .csv flat file (from a different server) and appends to an existing table. When I run the package from SQL Server Management Studio it works great. When I execute the Stored Procedure, I get an error stating "The system cannot find the file specified." Eventually, I would like to execute the Stored Procedure from an asp.net webpage button click event.
The code for the stored procedure:
USE [JElog]GODECLARE @return_value intEXEC @return_value = [dbo].[importGLJEdata]SELECT 'Return Value' = @return_valueGO
asp.net VB code:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myconn As New SqlConnection(ConfigurationManager.ConnectionStrings("JElog-SQL").ConnectionString)
Dim MyCmd As New SqlCommand("importGLJEdata", myconn)
MyCmd.CommandType = CommandType.StoredProcedure
myconn.Open()
MyCmd.ExecuteNonQuery()
myconn.Close()
End SubThanks,SMC
View 4 Replies
View Related
Jun 28, 2007
Hi
I use a stored procedure which uses its source as a database. It returns 3 outputs ie 2 int's and one datetime . I need to use these as the input columns to map to the destination coulmns in another stored procedure.
Help!!
View 1 Replies
View Related
Oct 17, 2007
Please anyone help me with my question
How do I execute a stored Procedure using SSIS ?
I have a stored procedure in SQL SERVER 2005 database that I need to execute using a SSIS package using Execute SQL Task from Toolbox in Visual studio 2005
Thanks,
George
View 2 Replies
View Related
Feb 2, 2007
Is there a programatic way to execute an SSIS package (passing the appropriate parameters) from within a stored procedure. I've seen some examples using xp_CmdShell, but would rather not go that route if possible
View 1 Replies
View Related
Feb 6, 2008
Quick question: In the OLE DB Command transform, you can pass parameters to a stored procedure.
One of my stored procedures has an OUTPUT parameter. How do I retrieve the output from the stored procedure?
View 3 Replies
View Related
Dec 29, 2006
Hi
I am currently trying to write a number of processe's to keep track of what information is held in my SSIS package. The package I have created is rather large and it would prove a long labourious process to look through every task to see what stored procedure has been used.
What I wanted to do was write a stored procedure in SQL Server 2005 that pick's up each package name and checks for any stored procedures used and returns the names of these stored procedures and any other relevant information i.e required variables.
So far I have managed to create a stored procedure that picks up the name(s) of the packages but I am stuck after this.
Declare @Filename varchar(1000)
Declare @cmd varchar(1000)
Create table #dir (Filename varchar(1000))
Insert #dir
Exec master..xp_cmdshell 'dir /B C:DevelopmentSumColumnSumColumn*.dtsx'
delete #dir where Filename is null or Filename like '%not found%'
Select @Filename = ''
While @Filename < (select max(Filename) from #dir)
drop table #dir
Any help would be appreciated.
Thanks
View 3 Replies
View Related
Jul 21, 2006
I have to transfer data from source to destination using stored procedures result set. There might be some more transformation needed to store the final result in the destination table.
Appreciate an early feedback.
Qadir Syed
View 29 Replies
View Related
Jan 11, 2007
Hi
I am trying to call a stored procedure which akes 1 input param from SSIS. I am using Execute SQL Task->Expressions->"exec s_Staging '"+ @[User::tblName] +"'"
@[User::tblName] is the variable with Data Type:String ,Value:My_table
SQLStatement->Stored Procedure Name
But It throws an error
[Execute SQL Task] Error: Executing the query "exec s_Staging 'My_Table' " failed with the following error: "Incorrect syntax near 'My_Table' ". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
View 13 Replies
View Related
Aug 23, 2007
I'm executing an SSIS package using the following stored procedure
ALTER PROC [dbo].[SSISRunBuildSCCDW] AS
BEGIN
DECLARE @ServerName VARCHAR(30), @ReturnValue int, @Cmd varchar(1000)
SET @ReturnValue = -1
SET @ServerName = 'myserver'
SET @Cmd = 'DTExec /SER ' + @ServerName + ' ' +
' /SQL ' + 'BuildSCCDW ' --Location of the package stored in the mdb
--' /CONF "\ConfigFilePath.dtsConfig" ' +
--' /SET Package.Variables[ImportUserID].Value; ' +
--' /U "LoginName" /P "password" '
EXECUTE @ReturnValue = master..xp_cmdshell @Cmd, NO_OUTPUT
RETURN @ReturnValue
--SELECT @ReturnValue [Result]
END
I'm then using a tableadapter to execute this from my ASP.NET page using the following code, Protected Sub ExecutePackage()
Dim ExecuteAdapter As New SCC_DAL.RunSSISTableAdapters.SSISRunBuildSCCDWTableAdapter()
ExecuteAdapter.SetCommandTimeOut(0)
Dim strResult As String
strResult = ExecuteAdapter.Execute()
lblResult.Text = strResult
End Sub
If I remove 'NO_OUTPUT' from my stored procedure and run it the results contain a field named 'output' with all the steps from my package. Then below this is my return value. In my code I can only return the first step of the package results - which tells me nothing useful. I need to be able to return the return value (0-6) in my code.
When I have 'NO_OUTPUT' in my stored procedure and execute it I am left with just the return value. However no value is returned in my code at all although the package does run. I've tried bother RETURN @ReturnValue and SELECT @ReturnValue to no avail.
Can someone suggest how I can get the value 0-6 to my code?
View 1 Replies
View Related
Feb 22, 2007
Hello friends!
I have one query regarding execution of SSIS package through Stored Procedure.
I have created SSIS package which extract data from database and put that into various text files.Here I am using two global variables one is for Department ID and another is path where I wanna to place my text files as per departments.When I ran it through command prompt it works fine but now I want that dtsx package to run from stored procedure with same input parameters
when i searched on line i got this solution
Declare @FilePath varchar(2000)
Declare @Filename varchar(1000)
Declare @cmd varchar(2000)
set @FilePath = 'C:setupSSIS PackagesSSIS Package File Extract DataSSIS Package File Extract Datain'
set @Filename = 'DataExtract.dtsx'
select @cmd = 'DTExec /F "' + @FilePath + @Filename + '"'
print @cmd
exec master..xp_cmdshell @cmd
but when i execute it i got error like
Source: {8A27E8DF-051B-4F6B-9538-85BED1F161D8}
Description: Unable to load the package as XML because of package does not have a valid XML format. A specific XML parser error will be posted.
End Error
Error: 2007-02-22 11:31:37.32
Code: 0xC0011002
Source: {8A27E8DF-051B-4F6B-9538-85BED1F161D8}
Description: Failed to open package file "C:setupSSIS PackagesSSIS Package File Extract DataSSIS Package File Extract DatainDataExtract.dtsx" due to error 0x80070003 "The system cannot find the path specified.". This happens when loadin
g a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format.
End Error
Could not load package "C:setupSSIS PackagesSSIS Package File Extract DataSSIS Package File Extract DatainDataExtract.dtsx" because of error 0xC0011002.
Description: Failed to open package file "C:setupSSIS PackagesSSIS Package File Extract DataSSIS Package File Extract DatainDataExtract.dtsx" due to error 0x80070003 "The system cannot find the path specified.". This happens when loading a
package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format.
And also I am not understand where i should pass my two input parameters which I used in SSIS package variables???????
Please help me out
Thanks
View 20 Replies
View Related
Mar 28, 2008
I'm trying to create a stored procedure which will run 2 SSIS packages before it runs some other SQL code. I read [url=http://msdn2.microsoft.com/en-us/library/ms162810.aspx]this[/url] article. I'm trying to use the package from the file system.
Here is the my code:
CREATE PROCEDURE usp_participant_limits_report
AS
dtexec /f "C:....Activity_Limits.dtsx"
GO
The error message says it doesn't like the "/". Anyone?
View 1 Replies
View Related
May 24, 2006
In SQL Server 2005 I need a stored procedure that will execute an SSIS Package for me. There is some earlier stuff on the board but I don't understand it. I don't want to create a Job to do it if I don't have to.
Thanks,
George Cooper
View 3 Replies
View Related
Mar 8, 2006
Hey guys,
I've got a problem here. I need to send the query result to a csv file then transfer the file to a website. I thought this is a good candidate for a SSIS package. The package is ready now but I don't know how can I execute it from within a stored procedure.
I thought sp_OA family of extended procedure would be helpfull. After following steps:
EXEC @hr1 = sp_OACreate 'DTS.Package', @oPKG OUT
EXEC @hr1 = sp_OAMethod @oPKG, 'LoadFromSQLServer("foo", ,, 256, , , , "foo1")', NULL
EXEC @hr1 = sp_OAMethod @oPKG, 'exec'
EXEC @hr1 = sp_OADestroy @oPKG
it tells me command execute successfully. But no package actually gets executed and I can see no results
Thanks
View 1 Replies
View Related
Sep 6, 2007
hi,
i have the following stored proc which returns a resultset at the end, i have an SSIS package that calls this stored proc and outputs the result to a file. However, the package fails because it cannot pull the columns for the schema because of the return lines in the middle of the stored proc. If i remove the it works fine, pulls hte columns as normal. but if i leave them in ssis cannot get the columns. what can i do to get around this?
ALTER PROCEDURE [dbo].[uspCreateBrightPointFile]
AS
SET nocount ON
IF EXISTS (SELECT TOP 1 *
FROM brightpointfile)
TRUNCATE TABLE brightpointfile
-- Get the order information from the database where vendorconfirmationID = 0
INSERT INTO brightpointfile
SELECT o.orderid,
o.requestid,
'295193' AS araccountnumber,
o.orderdate,
'PRIORITY' AS shipmethod,
'Asurion Dobson' AS billname,
'PO Box 110808' AS billaddress1,
'Attn Account Receivable' AS billaddress2,
' ' AS billaddress3,
'Nashville' AS billcity,
'TN' AS billstate,
'37222' AS billzip,
c.fullname AS shipname,
Replicate(' ',100) AS shipaddress1,
Replicate(' ',100) AS shipaddress2,
' ' AS shipaddress3,
Replicate(' ',40) AS shipcity,
' ' AS shipstate,
Replicate(' ',10) AS shipzip,
'1' AS linenumber,
ve.sku AS itemcode,
o.quantity AS qty,
r.typeid,
r.customerid,
0 AS addressfound
FROM [order] o WITH (NoLock)
JOIN request r WITH (NoLock)
ON o.requestid = r.requestid
JOIN customer c WITH (NoLock)
ON r.customerid = c.customerid
JOIN (SELECT [subequipid],
[subid],
[clientequipid],
[serialno],
[statusid],
[startdate],
[enddate],
[createdate],
[createuserid]
FROM subequip s1 WITH (NoLock)
WHERE s1.statusid = 1
AND s1.startdate = (SELECT MAX(s2.startdate)
FROM subequip s2 WITH (NoLock)
WHERE s2.statusid = 1
AND s2.subid = s1.subid)) se
ON r.subid = se.subid
JOIN vendorequip ve WITH (NoLock)
ON se.clientequipid = ve.clientequipid
JOIN clientequip ce WITH (NoLock)
ON ce.clientequipid = se.clientequipid
WHERE vendorconfirmationid IS NULL -- order was never sent to CellStar
AND ve.typeid IN (1) -- only pull direct fulfillment (not store fulfillment)
AND ve.vendorid IN (2) -- only pull vendor = CellStar Insurance
AND o.orderdate > '2007-08-01' -- only pull orders after 08/01/2007
--IF @@ERROR <> 0
--RETURN 1
--First use the address types of 2
UPDATE brightpointfile WITH (ROWLOCK)
SET shipaddress1 = b.address,
shipaddress2 = b.address2,
shipcity = b.city,
shipstate = b.stateid,
shipzip = b.zipcode,
addressfound = 1
FROM customeraddress a WITH (NOLOCK),
address b WITH (NOLOCK)
WHERE a.customerid = brightpointfile.customerid
AND b.addressid = a.addressid
AND a.typeid = 2
--IF @@ERROR <> 0
--RETURN 2
--Update the rest where the address type is 1 and there is no type 2
UPDATE brightpointfile WITH (ROWLOCK)
SET shipaddress1 = b.address,
shipaddress2 = b.address2,
shipcity = b.city,
shipstate = b.stateid,
shipzip = b.zipcode
FROM customeraddress a WITH (NOLOCK),
address b WITH (NOLOCK)
WHERE a.customerid = brightpointfile.customerid
AND b.addressid = a.addressid
AND a.typeid = 1
AND brightpointfile.addressfound = 0
--IF @@ERROR <> 0
--RETURN 3
--Select all the records from the temp table, plus union in 2 extra records required by the client
SELECT *
FROM (SELECT orderid,
requestid,
araccountnumber,
orderdate,
shipmethod,
billname,
billaddress1,
billaddress2,
billaddress3,
billcity,
billstate,
billzip,
shipname,
shipaddress1,
shipaddress2,
shipaddress3,
shipcity,
shipstate,
shipzip,
1 AS linenumber,
itemcode,
qty,
0 AS additional
FROM Brightpointfile WITH (nolock)
UNION ALL
SELECT orderid,
requestid,
araccountnumber,
orderdate,
shipmethod,
billname,
billaddress1,
billaddress2,
billaddress3,
billcity,
billstate,
billzip,
shipname,
shipaddress1,
shipaddress2,
shipaddress3,
shipcity,
shipstate,
shipzip,
brightpointdefaultsku.linenumber,
brightpointdefaultsku.sku,
1,
1 AS additional
FROM Brightpointdefaultsku WITH (nolock),
Brightpointfile WITH (nolock)) a
ORDER BY orderid,
additional
IF @@ERROR <> 0
RETURN 1
RETURN 0
View 3 Replies
View Related
Aug 7, 2007
Was wondering which is better, writing the SQL code within the execute SQL task or calling a SP from within it with respect to performance? and what is the best practice? Also is there any way to incoporate the logic of a cursur within SSIS?
Thanks
View 3 Replies
View Related
May 21, 2008
hi,
I need to convert a stored procedure in to a SSIS package, do any body have an idea on this. thanks in advance
View 1 Replies
View Related
May 30, 2008
Hi,
I'm using Execute SQL Task to call an Oracle stored procedure. The following is the error that I get.
Error: 0xC002F210 at Validate and Transfer Actuals, Execute SQL Task: Executing the query "{call RS2_RealProject_ETL.TransformLoadAction}
" failed with the following error: "ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'TRANSFORMLOADACTION'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
SQL statement syntax: {call RS2_RealProject_ETL.TransformLoadAction}
Per my review of the Forums, I'm entering the SQL syntax correct that is as follow and also use parameter names in Oracle in ordinal method starting from 0.
I have three "input" and one "output" parameter for the stored procedure that they all are of type "NUMBER" in oracle and I've defined them in "Parameter Mapping" window of Excute SQL Task as "NUMERIC".
I'd appreciate your help.
Thanks,
Reza
View 8 Replies
View Related
Feb 21, 2006
Hello,
Is there an oracle provider out there that will let me invoke a parameterless stored procedure that is in a package in my Oracle source?
Better could that stored proc receive a prameter?
Still better, could I use a stored proc in a OLEDB source component and get the resutls from its only out variable (ref cursor) into my SSIS dataflow?
I haven't been able to get any of these basic functionalities working with either the Oracle OLEDB or the Microsoft OLEDB for Oracle provider...
If not, are there any plans to enahnce the MS provider to handle that?
A more tricky question :
Why does the ReportingService data processing extension for Oracle sources allow such things and not the .NET provider in SSIS?
Thanks
View 6 Replies
View Related
Jul 22, 2005
how to excute ssis package from stored procedure and get the parameters back from ssis into the stored procedure.
View 23 Replies
View Related
May 18, 2015
I have used BCP to perform this, but I now need an SSIS package. Is this possible to use an SSIS package to automate the task?
View 1 Replies
View Related
Jun 5, 2014
I have a really big stored proc that needs to be rolled out to various databases as part of db installs I run through SSIS.
The Stored proc is too long to run using Execute SQL Task. Is there another way that just running the create script manually.
View 9 Replies
View Related
Jun 25, 2014
We require to convert a list of SPs in to SSIS packages. Most of the SPs do the below steps:
mainly our store procedure r to have compare the present date to past date , and comparing emp id between the files and also some joins. updating table r take place.
View 6 Replies
View Related
Mar 3, 2008
I need help debugging a CLR stored procedure that is being called from an SSIS package. I can debug the procedure itself from within Visual Studio by using "Step into stored procedure" from Server Explorer, but really need to debug it as it is being called from SSIS.
View 4 Replies
View Related
Dec 17, 2007
Hi
My PM and me are on a discussion. He wants SSIS to simply upload the source excel files in staging and do rest of the ETL in SQl server stored procedure which I feel is primitive.
I have suggested him to use SSIS for whole ETL and not Stored procedure( method which indistry has discarded)
He sayd Stored procedure are more efficient than SSIS.
Please guide with some facts.
View 12 Replies
View Related
Mar 19, 2008
Hi pals,
I am facing problems while calling Oracle stored procedure which has no parameters.
I have used Microsoft OLE DB provider for Oracle.
I have taken one Execute SQL task and set the SQLStatement as
call procedurename
I also set the IsStoredProcedure property to True for Execute SQL task.
Is there any synatx problem?
I am getting an error saying
Error: 0xC002F210 at Call Sp, Execute SQL Task: Executing the query "(call sp_procname)" failed with the following error: "ORA-00928: missing SELECT keyword.
I removed the curly braces for the SQL statement and again ran the Package, i am getting the below error
Executing the query "call sp_procname" failed with the following error: "ORA-06576: not a valid function or procedure name
Can anyone help me out on this regard!
Thanks in advance.
View 2 Replies
View Related
Jan 28, 2008
How do I use stored procedure or a user defined function as the data source in my SSIS package.
I am very new to SSIS.
Thanks
View 5 Replies
View Related
May 21, 2015
I have ssis package which is credated by VS-2010.
I want execute this SSIS package from the stored procedure (SQL server 2005).
View 3 Replies
View Related
May 29, 2006
Hi,
I figured out a way to execute an Oracle Stored Procedure from an Execute SQL Task by using
Declare
Begin
SomeStoredProc(?,?,?);
End;
with an OLE DB connection using the Oracle Provider for OLE DB.
The parameters are getting passed in and the procedure executes but if for some reason it fails SSIS is painting the task green and keeps processing. I'm guessing that's because the outer Declare/End statement completed sucessfully.
I couldn't get it to work as a function with a return value. :(
Is there another way to execute an Oracle stored procedure that I missed?
Can you call an Oracle stored procedure from a Script Task and then fail it on parameter value?
Thanks
John Colaizzi
View 4 Replies
View Related
Nov 9, 2006
Hi:
I would like to find out how would I call an AS400 (IBM DB2) iSeries Stored Procedure from within my SSIS Package. What tasks should i be using? and do I need any additional adapters installed on my machine to access AS400(IBM DB2). Thanks.
MA
View 1 Replies
View Related