How to call stored procedure by passing mapping variable $$date with source pre load using unconnect SP transformation in Informatica - informatica-powercenter

I want to pre load my source using stored procedure. I already have a SP created in my database. I am using unconnected SP transformation,providing the CALL TEXT property as "example($$date)" and also selecting SP type property as Source Pre Load but my session is failing. When i pass the value like "example('20201012') then its working fine. But my requirement is to pass the parameterized variable. I cannot change the SP present in database in anyway and have to per load the source. Help needed.

When you pass a datetime value through a stored procedure, the value must be in the Informatica date format and enclosed in double quotes. For example: proc("20201012")
When using a parameter, try proc("$$bus_date") or proc(to_char($$bus_date))

Related

TelerikReport send null as parameter to StoredProcedure

I want to use Telerik report in project, and want to use a stored-Procedure as data source. So, I should make a report in Telerik Report Designer in first step (my problem), and then use it in my Asp.net project.
I exactly used the (wizard) approach to make data source and parameters, mentioned in Telerik documentations, but there is a problem:
The report passes only the default parameter defined on design time, and when I change the parameter value in preview mode, it doesn't be passed to SP. If I set no default value for my parameters, the SP would be call by null values, always. It seems there is no mapping between input textboxes and the parameters are be sent to SP.
Is there anybody had the same experience, that can help me?
UPDATE:
What I did:
create new blank report in Telerik Report Designer R1 2017
From Data tab, Select SQL Data Source,select the proper SP from an Existing Data connection, leave the parameters default value empty and then execute...and finish.
In Report Explorer window, right click on Parameters, and add new parameter with the name and data type of stored procedure parameter. Change it's visibility to true, without any value.
From Home tab, select the preview and checked the SQL Profiler for db calls tracking. The Sp is called by null values at first time, but even when I change the parameter value in preview mode, again the SP is called by null parameter values.
In design time, after selecting your SP as data source, you will see the Configure Data Source Parameters.
In this window, you see your SP's parameters with value types. In Value column, click each row and select <New Report Parameter> and then select the parameter. The value will be change to proper value, for example:
= <Parameters.CustomerNumber.Value>
And this will work correctly. The problem was the 3th. step in question above. (adding the parameters, manually)

How do I set an SSRS Parameter that doesn't have a value to something else?

I have an SSRs Report with a parameter that gets information from SQL. If it hasn't found anything, at the moment it is just empty. Is there anyway to set it such that if it's empty it will return a different value, say "Please Extend Date Ranges" and disable the parameter?
If you using it to fill it using the SQL and using it for only internal purposes then there is option to make the parameter internal and it will be hidden and it will does not prompt the user.
Make a change to the stored procedure or query that populates the parameter. Include some logic so that if no results are returned by the query you are using now, it adds a row with the default label you want.
But no, you can't disable the parameter dynamically, I don't believe.

Using variables in From part of a task flow source

Is there any way to use a variable in the from part (for example SELECT myColumn1 FROM ?) in a task flow - source without having to give the variable a valid default value first?
To be more exact in my situation it is so that I'm getting the tablenames out of a table and then use a control workflow to foreach over the list of tablenames and then call a workflow from within that then gets data from these tables each. In this workflow I have the before mentioned SELECT statement.
To get it to work properly I had to set the variable to a valid default value (on package level) as else I could not create the workflow itself (as the datasource couldn't be created as the select was invalid without the default value).
So my question here is: Is there any workaround possible in this case where I don't need a valid default value for the variable?
The datatables:
The different tables which are selected in the dataflow have the exact same tables in terms of columns (thus which columns, naming of columns and datatypes of columns). Only the data inside of them is different (thus its data for customer A, customer B,....).
You're in luck as this is a trivial thing to implement with SSIS.
The base problem for most people is that they come at SSIS like it's still DTS where you could do whatever you want inside a data flow. They threw out the extreme flexibility with DTS in favor of raw processing performance.
You cannot parameterize the table in a SQL statement. It's simply not allowed.
Instead, the approach that people take is to use Expressions. In your case, assuming you had two Variables of type String created, #[User::QualifiedTableName] and #[User::QuerySource]
Assume that [dbo].[spt_values] is assigned to QualifiedTableName. As you loop through the table names, you will assign the value into this variable.
The "trick" is to apply an expression to the #[User::QuerySource]. Make the expression
"SELECT T.* FROM " + #[User::QualifiedTableName] + " AS T;"
This allows you to change out your table name whenever the value of the other variable changes.
In your data flow, you will change your OLE DB Source to be driven by a query contained in a variable instead of the traditional table selection.
If you want an example of where I use QuerySource to drive a data flow, there's an example on mixing an integer and string in an ssis derived column
Create a second variable. Set its Expression to create the full
Select statement, using the value of the first variable.
In the Data Source, use "SQL command from variable" option for the
Data Access Mode property.
If you can, set a default value for the variable you created in step
That will make filling out the columns from your data source much easier.
If you can't use a default value for the variable, set the Data
Source's ValidateExternalMetadata property to False.
You may have to open the data source with the Advanced Editor and
create Output columns manually.

SSIS For Loop Container equivalent in Talend Open Studio

I have a talend mapping which needs to be executed based on a ID. I want to pass the ID as a parameter. The mapping should execute for one ID at an time. I want to loop the execution for each ID one after the other. This can be achieved in SSIS using the For Loop Container. Can anyone help me finding out the equivalent for the same in Talend Open Studio.
Thanks in advance.
If you take just the Id part of your input and then link that to the main part of your current job with an Iterate link via a tFlowToIterate component it should automatically do this. You can access the value from the GlobalMap using something along the lines of ((String) GlobalMap.get("row1.Id")).
You can use the analogue tForeach component, and set the ID's values inside it. After that, you should connect the iterate output and reference the current value with the variable ((String)globalMap.get("tForeach_1_CURRENT_VALUE")) where the tForeach_1 is the name of your tForeach component.
And set the Query to something like:
"select id, name from employee
where id="+((String)globalMap.get("tForeach_1_CURRENT_VALUE"))

Execute Store Command Entity Framewrok

Hello I am using Entity Framework and I am using the ExecuteStoreCommand to do a query against the database. well I am basically calling a user defined function.
This is the call:
string result = m.ExecuteStoreQuery (SQL).FirstOrDefault();
I query the User Defined Function and I get the following result.
2.09,2.06,2.06,2.0098,2.04,2.04,2.04,2.04,2.04,2,2.1,2.04,2.04,2.04
The return type for the user defined function is
RETURNS Varchar(200). The result above is from the same cell.
When I execute the code from MVC controller I get the following error.The data reader has more than one field. Multiple fields are not valid for EDM primitive types.
What datatype I should be using instead of string.
Any ideas and suggestions.
Apparently, the return type is not only a string.
On the SQL Server side, try to surround the code of your query with:
SET NOCOUNT ON
<your current sql code>
SET NOCOUNT OFF
Maybe EF is getting the rows affected in the result and gets messed up.

Resources