Integration Services :: Assign Variables To Multiple Table Results From Stored Procedure

Sep 21, 2015

If I have a stored procedure that returns 15 tables, how do I distinguish the tables to assign variables to each table in c#?

View 6 Replies


ADVERTISEMENT

Please Help To Assign Multiple Results Into Individual Variables, Stored Procedure

Apr 12, 2008

I have a MSSQL2000 table called partspec.dbo.locationIn this table are 2 smallint columns: Tester (numbered 1-40) and Line (numbered with various integers)I am trying to create a stored procedure to read the tester number like so:Select Tester from partspec.dbo.location where Line = 2which will return up to 5 tester number results, lets say 11, 12, 24, 29 ,34My question is how do I store these tester numbers into 5 variables so that I may use them later in the sp ? So it would go something like this:CREATE PROCEDURE Table_Line
(@Tester1       integer,@Tester2        integer,@Tester3    integer,@Tester4    integer,@Tester5    integer)ASSELECT Tester FROM partspec.dbo.location where Line = 2Now this is where I'm confused on how to get 1 value into 1 variable and so on for all 5 values returned. This is what I would like to happen:
@Tester1 = 11@Tester2 = 12@Tester3 = 24@Tester4 = 29@Tester5 = 34GOThank you for any and all assistance.

View 2 Replies View Related

Integration Services :: Assign Values To Variables Dynamically In 2012 SSIS Package

Jul 16, 2015

Can I assign values to variables in 2012 using below command? I have used the same command in 2008 and it works fine.

DTEXEC
/SERVER"XXXXXXXXSQLSERVER2012"/SQL"Mypackage.dtsx"/SETPackage.Variables[FilePath].Value;"C:Test estvariable.csv"

Wondering is there a different way in 2012 to pass values to variables dynamically.

View 2 Replies View Related

Integration Services :: Pass Multiple Parameter Values To SSIS Package In 2012 Through Stored Procedure?

Jul 9, 2015

we can  assign one parameter value for each excecution of  [SSISDB].[catalog].[set_object_parameter_value] by calling this catalog procedure..

Example: If I have 5 parameters in SSIS package ,to assign a value to those 5 parameters at run time should I call this [SSISDB].[catalog].[set_object_parameter_value] procedure 5 times ? or is there a way we can pass all the 5 parameters at 1 time .

1. Wondering if there is a way to pass multiple parameters in a single execution (for instance to pass XML string values ??)
2.What are the options to pass multiple parameter values to ssis package through stored procedure.?

View 4 Replies View Related

Integration Services :: Getting Date Variables From Table

Oct 13, 2015

I created a date table with range of dates.

It has startdate, enddate, status which is the last successful run

The ssis package should select the dates from this table.

View 8 Replies View Related

How Can I Assign Data Returned From A Stored Procedure Into The Return Table Of A Table Valued Function

Apr 18, 2007

Here is the scenario,
I have 2 stored procedures, SP1 and SP2

SP1 has the following code:

declare @tmp as varchar(300)
set @tmp = 'SELECT * FROM
OPENROWSET ( ''SQLOLEDB'', ''SERVER=.;Trusted_Connection=yes'',
''SET FMTONLY OFF EXEC ' + db_name() + '..StoredProcedure'' )'

EXEC (@tmp)

SP2 has the following code:

SELECT *
FROM SP1 (which won't work because SP1 is a stored procedure. A view, a table valued function, or a temporary table must be used for this)

Views - can't use a view because they don't allow dynamic sql and the db_name() in the OPENROWSET function must be used.
Temp Tables - can't use these because it would cause a large hit on system performance due to the frequency SP2 and others like it will be used.
Functions - My last resort is to use a table valued function as shown:

FUNCTION MyFunction
( )
RETURNS @retTable
(
@Field1 int,
@Field2 varchar(50)
)
AS
BEGIN
-- the problem here is that I need to call SP1 and assign it's resulting data into the
-- @retTable variable

-- this statement is incorrect, but it's meaning is my goal
INSERT @retTableSELECT *FROM SP1

RETURN
END

View 2 Replies View Related

Integration Services :: SSIS Foreach Loop Container Passing Variables To Store Procedure

Sep 8, 2015

I am having a challenge to pass the filename variable from SSIS Foreach Loop Container to SQL store procedure.  I have an "Execute SQL Task" inside "Foreach Loop Container" which will receive the input filename parameter passed by the Foreach Loop Container.  The store procedure command line is defined as "EXEC sp_mySQLStoreProcedure  ?" within the "Execute SQL Task".  The Foreach loop container will gather the filenames from File System then put it in the filename variable one by one.  I would like to pass the filename variable as the input parameter to the sp_mySQLStoreProcedure in the "Execute SQL Task".  How can I connect the variable and the store procedure so that it will process all the input files gathered by the Foreach Loop Container?

View 4 Replies View Related

Retrieve Multiple Variables From Stored Procedure (SQLHelper)

Jun 22, 2004

Hi all,

I am using SQLHelper to run a Stored Procedure.
The Stored Procedure returns 3 variables:

ie:

SELECT @Hits = COUNT(DISTINCT StatID) FROM Stats

...etc...

The SP is currently called as below:

SqlParameter[] sqlParams = new SqlParameter[]
{
new SqlParameter("@FromDate", Request["FromDate"]),
new SqlParameter("@ToDate", Request["ToDate"]),
};


My question is this: How do I retrieve these variables?

I know I need to declare a new SqlParameter and change it's Direction to Output but I am unsure of the exact syntax required to do this.

Thanks in advance,

Pete

View 5 Replies View Related

Integration Services :: Oracle Procedure Is Not Returning Results When Executing From Script Task On SSIS

Jul 13, 2015

I'm executing Oracle procedure, which has three OUTPUT parameters and returns results in table type variable. i should not use ODBC, MSDAORA providers to call the procedure. So I'm planning to using Oracle OLEDB provider. I'm able to execute the procedure successfully, but when i do check (while dr.Read()) its not returning any records. But I know as per stored procedure results, it should return 66 records.

Dim conn As New OleDbConnection
Dim cmd As New OleDbCommand
Dim dr As OleDbDataReader
Dim QSQL As String

[code]...

View 10 Replies View Related

Integration Services :: Insert Multiple Columns As Multiple Records In Table Using SSIS?

Aug 10, 2015

Here is my requirement, How to handle using SSIS.

My flatfile will have multiple columns like :

ID  key1  key2  key3  key 4

I have SP which accept 3 parameters ID, Key, Date

NOTE: Key is the coulm name from the Excel. So my sp call look like

sp_insert ID, Key1, date
sp_insert ID, Key2,date
sp_insert ID, Key3,date

View 7 Replies View Related

Multiple Results From One Stored Procedure

May 17, 2007

If I have multiple selects statements in one stored procedure. How do I access the different results in a report in Reporting Services? Where the first select is the detail lines of my report and the second select is just a field for a my header? Or am I going about this wrong with putting it all the results I want into one stored procedure for one report?



Example stored procedure:



ALTER PROCEDURE [dbo].[proc_DepositsByOfficer]

As

SELECT MASTER_DSC.APP

, MASTER_DSC.BRANCH

, qlkpOfficer.strName

, MASTER_DSC.DSC_OFFICER_49

, qlkpBranchName.strDescrS

, MASTER_DSC.DSC_CUR_BAL_21

, Case MASTER_DSC.APP WHEN 1 Then DSC_CUR_BAL_21 End AS DDA_BAL

, Case MASTER_DSC.APP WHEN 2 Then DSC_CUR_BAL_21 End AS SAV_BAL

, Case MASTER_DSC.APP WHEN 3 Then DSC_CUR_BAL_21 End AS CD_BAL

, MASTER_DSC.DSC_INT_RATE_45

, Case When [DSC_CUR_BAL_21]>0 Then ([DSC_CUR_BAL_21]*[DSC_INT_RATE_45])/100 Else 0 End As ANN_EXP

, Case When [DSC_CUR_BAL_21]>0 And MASTER_DSC.APP=1 Then ([DSC_CUR_BAL_21]*[DSC_INT_RATE_45])/100 Else 0 End AS ANN_EXP_DDA

, Case When [DSC_CUR_BAL_21]>0 And MASTER_DSC.APP=2 Then ([DSC_CUR_BAL_21]*[DSC_INT_RATE_45])/100 Else 0 End AS ANN_EXP_SAV

, Case When [DSC_CUR_BAL_21]>0 And MASTER_DSC.APP=3 Then ([DSC_CUR_BAL_21]*[DSC_INT_RATE_45])/100 Else 0 End AS ANN_EXP_CD

, Case MASTER_DSC.APP WHEN 1 Then 1 End AS DDA_Count

, Case MASTER_DSC.APP WHEN 2 Then 1 End AS SAV_Count

, Case MASTER_DSC.APP WHEN 3 Then 1 End AS CD_Count

, qlkpApplicationCode.strDescrS AS strApplCode

FROM

MASTER_DSC

INNER JOIN qlkpApplicationCode ON MASTER_DSC.APP=qlkpApplicationCode.dblReference

LEFT JOIN qlkpOfficer ON MASTER_DSC.DSC_OFFICER_49=qlkpOfficer.intID

LEFT JOIN qlkpBranchName ON MASTER_DSC.BRANCH=qlkpBranchName.dblReference

WHERE

MASTER_DSC.DSC_CUR_BAL_21<>0

ORDER BY

MASTER_DSC.BRANCH;



SELECT dbo.fBankName() AS BankName;

View 7 Replies View Related

Identifying Results Sets When Stored Procedure Called Multiple Times

Oct 18, 2005

I have a report based on our product names that consists of two parts.Both insert data into a temporary table.1. A single grouped set of results based on all products2. Multiple tables based on individual product names.I am getting data by calling the same stored procedure multipletimes... for the single set of data I use "product like '%'"To get the data for individual products, I am using a cursor to parsethe product list.It's working great except that I have no idea how to identify theresults short of including a column with the product name. While thatis fine, I'm wondering if there is something that is like a header ortitle that I could insert prior to generating the data that would looka little tighter.Thanks in advance-DanielleJoin Bytes!

View 3 Replies View Related

Table Variables In Stored Procedure

Jan 11, 2006

I am using a table variable inside a stored procedure that I am trying to execute from an OLE Datasource task in IS.  I know there was a problem doing this in DTS, which would result in an Invalid Pointer error.  I am not getting that error, but I am getting an error that says "[OLE DB Source [55]] Error: A rowset based on the SQL command was not returned by the OLE DB provider."  The stored procedure runs fine on it's own.

Any thoughts?

 

 

View 24 Replies View Related

Reporting Services :: Different Results In Stored Procedure And In Report

Oct 21, 2015

Created a report with parameters that can have multiple values.

Ran Stored procedure with same above criteria and data is retrieved

Ran the report and no data is displayed

I am unable to figure out where it might have gone wrong.

View 3 Replies View Related

Integration Services :: Assign Different Static Increment Value In Different CSV Files Using SSIS?

Jul 29, 2015

I have a table T with columns Code datatype is nvarchar(5) andName nvarchar(30). Table T has 100 records and column Name only have data and column Code has Null values.

I have to generate csv files using this table data through SSIS . Each file should have 25 records and assign some static value(different for each file ex: file1 is T1 and file2 is T2..etc) in column Code . I am able to generate files with 25 records for each file but not able to assign different static value in different csv files. Is it possible using SSIS?

View 2 Replies View Related

T-SQL (SS2K8) :: Nested Stored Procedure - Multiple Results Of Record Sets Coming

Oct 1, 2014

I am calling stored procedure called GetCommonItemCount within another stored procedure called CheckBoxAvailability, the first stored procedure should return a count to second stored procedure and based on that some logic will be executed.

I have 2 problems in that

1. The result is not coming from first stored so the variable called @Cnt is always 0 although it should be 18
2. At the end i need to see in the output the result from second stored procedure only while now i am seeing multiple results of record sets coming.

I have attached the scripts also, the line i described in step1 is

View 9 Replies View Related

Reporting Services :: SSRS Not Able To Load Results From Stored Procedure

Sep 9, 2015

I have created a query in which I have used first_value, lead, lag windows functions. I tried using the query in SSRS query text, but for some reason it could not load. Then I created a stored procedure and implemented that query in stored proc.

The problem is that I am able to execute the stoured proc from sql server studio, but SSRS is not able to load data.

View 5 Replies View Related

Integration Services :: How To Search A Table In Multiple Packages

Dec 3, 2015

I have 5-6 table and wanna to make sure if I'm using any of them in my Packages and I do have 100 Packages.shortest way to search these tables in Packages.

View 2 Replies View Related

Invokation Of A Stored Procedure From An Integration Services Package

Jun 9, 2006

Is it possible to execute a stored procedure from an Integration Services package? I see that its possible to enter sql commands that can be run but when a command to execute a stored procedure is entered the system cannot find the stored procedure (eventhough 'use mydbname' preceded it.

thx,

Marilyn

View 1 Replies View Related

Integration Services :: Passing Value In File To Stored Procedure

Jun 2, 2015

I am trying to read a flat file that contains a number like 256395 for example. I want to store this as a variable then pass it onto a stored procedure to run then saves the results to a flat file.

View 5 Replies View Related

Variables As Table Or Column Names In A Stored Procedure

Apr 16, 2008

I would like to use variables to set the table name and some column names of a SQL Query in a stored procedure (the variable values will come from a webpage)... something like this:ALTER PROCEDURE dbo.usp_SelectWorkHours
@DayName varchar,@DayIDName varchar
AS
BEGINSELECT @DayName.InTime1, @DayName.OutTime1, @DayName.InTime2, @DayName.OutTime2 FROM @DayName
INNER JOINWorkHours ON @DayName.@DayIDName = @DayName.@DayIDName
INNER JOINEmployees ON WorkHours.WorkHoursID = Employees.WorkHoursID
END
RETURN
...is this possible?? if so how?
Thanks

View 2 Replies View Related

Integration Services :: Assign Value Of Aggregate Transform To A Variable Without Using Script Task In SSIS

Jun 2, 2011

In my current project i have a requirement to assign value of an aggregate transform to a variable. But i need to accomplish it without using a script task.

View 3 Replies View Related

Integration Services :: Converting Stored Procedure To Inline Query

May 30, 2015

I have a stored proc that is being executed from an OLE DB Source component in my Data Flow. Takes one input parm, has several variables declared within, a derived table which is used in a join and all within a try catch block with transaction handling. No updates, just returning data, works great, except now I have been asked to replace these stored procs with inline queries.

ALTER PROCEDURE [dbo].[usp_Get_Test]
(
@numberOfMonthsint
)
AS
BEGIN
SET NOCOUNT ON
set transaction isolation level read uncommitted

[Code] ....

The problems I have run into so far are...

SQL command text in OLE DB Source Editor does not like:
- TRY/CATCH block
- Will not let me use my input parm (@numberOfMonths int)
- When I hard code in my input parm (select   @BeginDate = dateadd(MONTH, -1, GETDATE())) I can parse query and run the step but no results are returned. So I am let to assume that it does not like the @TESTY derived table.

The query here as a sample has had pivots removed as well, but research suggests this should be an issue in the SQL command text.

Also, I know not even to try the Build Query... cause it will complain about any variable declarations (i.e., declare @BeginDate datetime).

For instance, can I pull this off with an Execute SQL Task? The problem is I don't see this available in the toolbox for the Data Flow. 

Also, would my error handling be done in the Event Handlers tab now and if so, is there a good example of this?

View 3 Replies View Related

Integration Services :: Creating A File Using Stored Procedure In SSIS

Jun 24, 2015

I'm trying to create a file using a stored procedure with SSIS.  I've tried to use the Execute SQL Task, but it will not create a file nor output to that file.  I'm using "Full result set", but I don't know how to sent the result to the file.  Is there another Control Flow Item I need to use?The reason why I'm using SSIS and not SQL Server Agent is because the file name must contain a timestamp.

View 3 Replies View Related

Integration Services :: Log Inserted And Updated Count Done By Stored Procedure

Sep 8, 2015

I am run a stored procedure using Execute SQL task in, I want to log information of number of record inserted update in my table. I want to enable SSIS logging after from where I get information number of record inserted update.

I am using SQL server 2008R2 standard edition.

View 4 Replies View Related

Integration Services :: Reading Multiple Excel Sheet With Different Table Schema

Apr 15, 2015

How to read multiple excel sheets in same excel file with different table schema.

Basically need to load data into tables from these excel sheet. 

So I know how to dynamically read multiple excel sheets in same excel file with same table schema and load into one table.

But how to do this dynamically for multiple excel sheet with different table schema and load into different tables?

View 7 Replies View Related

Integration Services :: Load Multiple Files From Table Using For Each Loop Container

Oct 28, 2015

I have a requirement to load multiple flat files in target table .

I have created the package which used to load files into target table using For each loop container.

But now requirement has been changed now I have to take only those files from table where status="Success" and max JobId. By the query I am to get those records which need to load into table.

Below query I am using to get the files which need to load.

select [JobLogKey],[SrcNm],[DestNm]
FROM [ConfigRep].[dbo].[JobLog]
Where [JobId]=
(Select Max(cast([JobId] as Int)) Jobid
FROM [ConfigRep].[dbo].[JobLog]
Where [JobStat]='Success')

Output:-

JobLogKey SrcNm   DestNm
268 H:Data PlatformSource FileClient2LocHGSSpecLocation.txt Location.txt
269 H:Data PlatformSource FileClient1LocHGSSpecLocation.txt Location.txt

I have to load using above 2 files which are under SrcNm. I have created one variable called FileToLoad as Object and mapping to result set of above query. I have create JobId,SrcNm and DestNm variable to catch the record at every loop. I have  created 2 For each Loop container 

Below screen shot of outer Foreach loop. Till here Its working fine. Inner for each loop container not executing any task under that. How to get it done.

View 3 Replies View Related

Integration Services :: Using SSIS To Call A Stored Procedure On AS400 Iseries DB2?

Jun 4, 2015

I have developed an SSIS Package which uses an ODBC connection to an AS400 iseries stored procedure. I use an Execute SQL Task. The query is Call Doctrack.PubFeed(?,?,?,?). The procedure takes 2 input parameters and 2 output parameters (3rd and 4th parameters) The data types of the output parameters are  an integer and varchar.   As part of the procedure data is inserted into a table on the iseries. 

When I run the package using breakpoints to view the values of the variables I see that the stored procedure returns values for the output parameters  and the execute SQL task is a success and proceeds to the next task in the package.  The whole package ends successfully.However, when the table on the iseries is checked nothing has been inserted into it.  To test further,  I manually run the procedure on the iseries using the same parameters.  The run is successful.  And when the table is checked, there are in fact new rows inserted.

What can possibly be the issue since I am not getting any errors when I run the package?  Oh I should add that prior to the execute Sql Task,  there is a data flow task which moves data from a SQL Server database  to a table on the iseries (successfully) using the same ODBC connection.  The execute sql tasks uses that information for the Stored procedure.

View 6 Replies View Related

Integration Services :: Store Multiple Config In Single Table Using SSIS Configurations?

Oct 20, 2015

I want to store multiple config files into single table I am unable to do it.

View 8 Replies View Related

Integration Services :: Audit Logging In Table With Multiple OLEDB Destination And Command

Jun 5, 2015

In my package there are 10 DFT.

Each DFT have source > Tranformation > Conditionsplit > Rowcount_Transformation  >   Oledb Command
                                                                                
> Rowcount_Transformation1 >  Oledb Command1
                                                                                
> Rowcount_Transformation2 >  Oledb Command2
                                                                                
> Rowcount_Transformation3 >  Oledb Command3

All update hapend on diffrent Table.I want to log in Audit table .

My audit table like

Table_Name   Insert_count  Update_count

How can I log the package having multiple OLEDB Destination.

View 7 Replies View Related

How To Stored A Stored Procedure's Results Into A Table

Jul 23, 2005

Hi, How can I store a stored procedure's results(returning dataset) intoa table?Bob*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 1 Replies View Related

How Can I Assign A Stored Procedure As Cursor's Data Source In AStored Procedure?

Oct 8, 2007

How can I create a Cursor into a Stored Procedure, with another Stored Procedure as data source?

Something like this:

CREATE PROCEDURE TestHardDisk
AS
BEGIN

DECLARE CURSOR HardDisk_Cursor
FOR Exec xp_FixedDrives
-- The cursor needs a SELECT Statement and no accepts an Stored Procedure as Data Source

OPEN CURSOR HardDisk_Cursor


FETCH NEXT FROM HardDisk_Cursor
INTO @Drive, @Space

WHILE @@FETCH_STATUS = 0
BEGIN

...
END
END

View 6 Replies View Related

Integration Services :: Commit N Number Of Records (SSIS Versus Stored Procedure)

May 8, 2015

I have a stored proc that is returning the results I need for output to .txt file.

Is there a way in SSIS to commit 50K (or whatever number) row batches at a time or should I just handle this in the stored proc?

select * into #TempTable
from SomeTable
[WHILE LOOP] --throttle commit batches of 50K rowcount
select *
from #TempTable
[END LOOP]
drop table #TempTable

But If I'm doing this in SSIS, I can't drop the #temp table otherwise I have nothing to output right?

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved