Passing value while running a SSIS SQL Task?
Hi All,
I am using SQL Server 2008 and Visual Studio 2008 for developments.
I have a procedure on the database, which works fine, when I execute the procedure , I can input a value for the parameter and I can see the result set.
Procedure is as below:
USE [DW]
GO
/****** Object: StoredProcedure [dbo].[Command2] Script Date: 10/01/2014 4:07:58 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Command2]
@ReportDate nvarchar(50) = NULL -- NULL default value
AS
SET NOCOUNT ON;
IF @ReportDate IS NULL
BEGIN
PRINT 'ERROR: You must specify a Report Date.'
RETURN
END
-->>
SELECT *
FROM BB.dbo.Daliy_Sales
WHERE effective_date < @ReportDate;
RETURN
I Just want to create SSIS job to have the above procedure.
I created a new SSIS project and add a "Execute SQL Task" container from the tool bar and provided values as below :
Connection Type: OLE DB
Connection: ---provided
SQLSource Type : Direct Input
SQL Statement : exec dbo.Command2
When I run the job, through Debugger, it didn't ask me to input a value for the parameter which in the stored procedure, job turned out be 'green' color , but no rows were displayed...
I want to input a value, then to run SSIS task, what changes should I require to make this happen???
Thanks in advance.
Mira
you need to create a variable inside SSIS to hold date value.
Then command inside execute sql task should be
exec dbo.Command2 ?
and map variable to parameter 0
When calling package pass your date value to variable by adding it as a configuration item inside config file/sql table and setting value inside file/table
Or if calling package using dtexec utility set variable value using /SET switch
http://www.mssqltips.com/sqlservertip/1812/dtexec-command-line-parameters-using-command-files/
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
Similar Messages
-
Why can't I save control values while running an application in 6.1?
In Labview 5.1 I was able to save change control and indicator values while running the application. I accomplished this by using the MAKE CURRENT VALUES DEFAULT Method on a VI invoke node. How do I accomplish the same in 6.1?
If I remember correctly, the same limitation with the method existed in 5.1 as it does in 6.1 - namely you can't use the method while the VI is running. See here, here, and here for just a brief sample of the numerous times this question has come up and the possible solutions.
-
Stored procedure fails when run from SSIS DataFlow task
I'hv a stored procedure (with dynamis SQL), taking colums names as parameters to run and returns dynamic columns in output. E.g. if I pass @ipselect = '*' it will returns all columns in output, when I pass @ipselect = 'column1, column2, column3'
,it will returns 3 columns in output.
Now I have SSIS package. I've Data Flow task in foreach loop container and it is taking parameter from client table. e.g
clientid column name
1 *
2 columns1,columns2,column3
3 columns1,columns2,column3,columns4,columns5,column6
4 *
Foreach container loop through each client id and set ipselect parameter with
column name and that value is being passed to @ipselect stored procedure in Dataflow task. When there is @ipselect = '*' it runs fine ,returns all columns and write to destination. But when there is ipselect = 'columns1,columns2,column3',
it fails with below error:
[OLE DB Source [1]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E55.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E55 Description: "Column does not exist.".
[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "OLE DB Source" (1) returned error code 0xC0202009. The component returned a failure code when the pipeline engine called PrimeOutput().
The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
Any suggestion or solution would be really helpful.
Thanks!!Hi Kevin,
Just an addition. To create SSIS package programmatically, please refer to the document:
http://msdn.microsoft.com/en-us/library/ms345167.aspx
To implement dynamic column mapping through SSIS Script Component, please refer to:
http://wikiprogrammer.wordpress.com/2011/04/08/dynamic-column-mapping-in-ssis-part-1/
http://blog.quasarinc.com/ssis/best-solution-to-load-dynamically-change-csv-file-in-ssis-etl-package/
Regards,
Mike Yin
TechNet Community Support -
Pass value at run time from one structure to diffrent structure
hi experts.
i m workin on crm domain and faching problem to pass value from one stucture to another . problem is that i want the output in xml file so i need all the values interm of segment.
initialy i have this structure.
DATA: BEGIN OF struc1 occurs 0,
ST_ORDERADM_H TYPE CRMT_ORDERADM_H_WRKT,
ST_PRICING TYPE CRMT_PRICING_WRKT,
ST_ORGMAN TYPE CRMT_ORGMAN_WRKT,
ST_PARTNER TYPE CRMT_PARTNER_EXTERNAL_WRKT,
END OF struc1.
and using fm CALL FUNCTION 'CRM_ORDER_READ' i got values on this structure at run time.
MOVE LT_ORDERADM_H to STRUC1-ST_ORDERADM_H.
MOVE LT_ORGMAN to STRUC1-ST_ORGMAN.
MOVE LT_PARTNER to STRUC1-ST_PARTNER.
MOVE LT_PRICING to STRUC1-ST_PRICING.
and after that using
try.
CALL TRANSFORMATION id
SOURCE data_node = STRUC1
RESULT XML xmlstring.
CATCH cx_st_error.
endtry.
CLEAR: tab_xstring,
lv_filename,
lv_path,
lv_fullpath,
lv_user_action.
REFRESH: tab_xstring.
lv_bytes = XSTRLEN( xmlstring ).
IF lv_bytes > 0.
lv_xstring = xmlstring.
DO.
APPEND lv_xstring TO tab_xstring.
lv_xcnt = XSTRLEN( lv_xstring ).
IF lv_xcnt > xsize.
lv_xstring = lv_xstring+xsize.
ELSE.
EXIT.
ENDIF.
ENDDO.
now it convert to xml file .
problem is it gives me value of all field associated with standared structure.
but client requirment is that he want only selected values of given structure.
so i think i make a new structure for given value but i m not able to get values in new structure.
thanksHi,
create a structure in se11 with following fields
ST_ORDERADM_H.
ST_ORGMAN.
ST_PARTNER.
ST_PRICING.
for example as STRUCT2.
data : begin of i_struct2 occurs 0.
include structure struct2.
data : end of i_struct2.
MOVE LT_ORDERADM_H to i_STRUCt2-ST_ORDERADM_H.
MOVE LT_ORGMAN to i_STRUCt2-ST_ORGMAN.
MOVE LT_PARTNER to i_STRUCt2-ST_PARTNER.
MOVE LT_PRICING to i_STRUCt2_PRICING.
then
try.
CALL TRANSFORMATION id
SOURCE data_node = i_STRUCt2
RESULT XML xmlstring.
CATCH cx_st_error.
endtry. -
Having troubles passing values of Shuttle control to SQL Query of Report and Chart Region
Hello,
I am very new to APEX and need help for one of the Pa.I have a shuttle control on my page which populates Categories. Once user selects Categories from this control, I wish to pass the values to following SQL query :
select * from emp_class where category IN ( LIST of VALUES FROM RIGHT SIDE SHUTTLE).
I tried various ways of doing this including writing a java scripts which reads shuttle value, converts it into below string
'Category1',Category2',Category3'. Then I set this value to a text box. And then I was expecting that below trcik would work
select * from emp_class where category IN (:TXT_VALUES)
I am sure this is not right way and hence its not working. Can you please guide me here with options?
Many Thanks,
Tushb96402b4-56f7-44ba-8952-fb82a61eeb2c wrote:
Please update your forum profile with a real handle instead of "b96402b4-56f7-44ba-8952-fb82a61eeb2c".
I am very new to APEX and need help for one of the Pa.
Don't understand what this means. What is "Pa"?
select * from emp_class where category IN (:TXT_VALUES)
I am sure this is not right way and hence its not working. Can you please guide me here with options?
This is a common fallacy. In
select * from table where columnvalue in (7788, 7839, 7876)
(7788, 7839, 7876) is an expression list and the predicate is evaluated as a membership condition.
In
select * from table where columnvalue in :P1_X
:P1_X is a scalar string, incapable of containing multiple values.
In an APEX standard report, a PL/SQL function body returning an SQL query report source with lexical substitution can be used to produce a "varying IN-list":
return 'select * from table where columnvalue in (' || :P1_X || ')';
where P1_X contains fewer than 1000 values, has been sanitized for SQL injection, and string values are properly quoted.
Some people suggest the following approach, which will also work in APEX interactive reports:
select * from table where instr(':' || :P1_X || ':', ':' || columnvalue || ':') > 0
However this is non-performant as it eliminates the possibility of the optimizer using indexes or partition pruning in the execution plan.
See varying elements in IN list on Ask Tom, and emulating string-to-table functionality using sql for efficient solutions. -
Error while running the SSIS package from SQL DB to excel file - export option
hi all,
I have 4.6 million records in my sql db and i want to copy this into a excel file. for this i went to the db and rt click and export to command and started the ssis package running. but after
few minutes, it throws me an error that "error in transferring data into excel file."
Can anyone help me why this happened and the resolution ?
help is appreciated!
Copying to `excel1_Wbook` (Error)
Messages
Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x8007000E.
(SQL Server Import and Export Wizard)
Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination - excel1_Wbook" (217) failed with error code 0xC0202009 while processing input "Destination Input" (228).
The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information
about the failure.
(SQL Server Import and Export Wizard)
Error 0xc02020c4: Data Flow Task 1: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020.
(SQL Server Import and Export Wizard)
Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Source - excel1_Wbook returned error code 0xC02020C4. The component returned a failure code when the pipeline engine called PrimeOutput(). The
meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)You need to split your data and create (at least 5) worksheet targets.
For example if you have a ROW_NUMBER column you can use for instance a
Conditional Split for something like:
ROW_NUMBER % 5 == 0 for Case 1 (excel 1)
ROW_NUMBER % 5 == 1 for Case 2 (excel 2)
ROW_NUMBER % 5 == 2 for Case 3 (excel 3)
ROW_NUMBER % 5 == 3 for Case 4 (excel 4)
ROW_NUMBER % 5 == 4 for Case 5 (excel 5) -
Using the Form javascript.addrow() to pass values while creating a new row?
Version: 4.1.0
DB: 11g
Theme- scarlet 21
Hi,
I have a standard tabular form with the add, delete, submit buttons. Now when we hit the Add button, it creates a new row in the form. I had a requirement such that the user selects a row using the standard checkbox and then when he hits add, it should create a new row, and also, copy the contents of the selected row to the new row.
Is this possible? Any suggestions please? I am thinking that I need to create a pl/sql process under Add button to check if the checkbox is selected, and if yes, then maybe run the javascript addrow(not sure if it can be done) and then try to populate the values.
Thanks!
Sun
Edited by: ryansun on Oct 4, 2012 12:34 AM
Edited by: ryansun on Oct 4, 2012 12:46 AM
Edited by: ryansun on Oct 4, 2012 12:46 AMHi Joni,
Thanks. I am not familiar with JQuery, is there some link where such a logic is implemented? Atleast a basic one of adding a new row, and traversing and capturing the values? In forms we could do it using cursor but not sure how to do it in Apex.
In my case the requirement is straightforward. If there is a table with three rows and have a standard form in APEX with the add, delete and submit buttons along with the radio checkbox in a tabular form,
If I select a row and then hit the add button, a new row should be added and the values of the previous row should be passed.
Would you be having a link to any such demo or documentation on how this is done, would be very helpful.
Thanks!
Sun -
Passing values at run time through a JSP page to selection formula to crystal report
<p>hi,</p><p> i am using one jsp page.in that page there is a field to select a date </p><p>this value will go to the report and report contain one selection formula.</p><p>which value we are passing on that basis the report should display</p><p>with date which we are passing from GUI.</p><p>help.............................................................</p><p>//R</p>
I believe the value of this is based on the owner of the scheduled object. So if the Admin is scheduling it on behalf of a user I think it should use the user the Admin scheduled on behalf of. It should be simple to test, simply create a report with this value being displayed and nothing else and see what values you get.
-
when debugging SSIS, the "Execute SQL Task" runs a stored procedure and returns the expected value. When running the package a second time, the task returns an unexpected value. When running in VS2012 SQL editor, everything operates as expected.
Please help me debug how to get the stored proc to return the same value every time the SSIS Package is run. thanks!
Here is the sequence of events and what happens....
Look for a Positor that matches the Application, Host, and User
No matching PositorId is found, Creates new Positor row, returns that new PositorId
Use PositorId to upload some data (Every thing works)
re-run/debug the ssis pacakge
Look for a Positor that matches the Application, Host, and User
<No clue what is happening>
Returns -1 (SHOULD BE the same PositorId value returned in #2)
"Execute SQL Task" Setup: No edits to Result Set nor Expressions
"Execute SQL Task" Setup: GENERAL
"Execute SQL Task" Setup: PARAMETER MAPPING
SP called by "Execute SQL Task"
CREATE PROCEDURE [posit].[Return_PositorId]
AS
BEGIN
DECLARE @PositorId INT = [posit].[Get_PositorId]();
IF (@PositorId IS NULL)
BEGIN
DECLARE @ProcedureDesc NVARCHAR(257) = OBJECT_SCHEMA_NAME(@@PROCID) + N'.' + OBJECT_NAME(@@PROCID);
DECLARE @PositorNote NVARCHAR(348) = N'Automatically created by: ' + @ProcedureDesc;
EXECUTE @PositorId = [posit].[Insert_Positor] @PositorNote;
END;
RETURN @PositorId;
END;
Supporting SQL Objects:
CREATE FUNCTION [posit].[Get_PositorId]
RETURNS INT
AS
BEGIN
DECLARE @PositorId INT = NULL;
SELECT TOP 1
@PositorId = [p].[PO_PositorId]
FROM [posit].[PO_Positor] [p]
WHERE [p].[PO_PositorApp] = APP_NAME()
AND [p].[PO_PositorHost] = HOST_NAME()
AND [p].[PO_PositorUID] = SUSER_ID();
RETURN @PositorId;
END;
GO
CREATE PROCEDURE [posit].[Insert_Positor]
@PositorNote NVARCHAR(348) = NULL
AS
BEGIN
DECLARE @ProcedureDesc NVARCHAR(257) = OBJECT_SCHEMA_NAME(@@PROCID) + N'.' + OBJECT_NAME(@@PROCID);
SET @PositorNote = COALESCE(@PositorNote, N'Automatically created by: ' + @ProcedureDesc);
DECLARE @Id TABLE
[Id] INT NOT NULL
INSERT INTO [posit].[PO_Positor]([PO_PositorNote])
OUTPUT [INSERTED].[PO_PositorId]
INTO @Id([Id])
VALUES(@PositorNote);
RETURN (SELECT TOP 1 [Id] FROM @Id);
END;
GO
CREATE TABLE [posit].[PO_Positor]
[PO_PositorId] INT NOT NULL IDENTITY(0, 1),
[PO_PositorApp] NVARCHAR(128) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorApp] DEFAULT(APP_NAME()),
CONSTRAINT [CL__PO_Positor_PO_PositorApp] CHECK([PO_PositorApp] <> ''),
[PO_PositorName] NVARCHAR(256) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorName] DEFAULT(SUSER_SNAME()),
CONSTRAINT [CL__PO_Positor_PO_PositorName] CHECK([PO_PositorName] <> ''),
[PO_PositorHost] NVARCHAR(128) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorHost] DEFAULT(HOST_NAME()),
CONSTRAINT [CL__PO_Positor_PO_PositorHost] CHECK([PO_PositorHost] <> ''),
[PO_PositorSID] VARBINARY(85) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorSID] DEFAULT(SUSER_SID()),
[PO_PositorUID] INT NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorUID] DEFAULT(SUSER_ID()),
[PO_PositorNote] VARCHAR(348) NULL CONSTRAINT [CL__PO_Positor_PO_PositorNote] CHECK([PO_PositorNote] <> ''),
[PO_tsInserted] DATETIMEOFFSET(7) NOT NULL CONSTRAINT [DF__PO_Positor_PO_tsInserted] DEFAULT(SYSDATETIMEOFFSET()),
[PO_RowGuid] UNIQUEIDENTIFIER NOT NULL CONSTRAINT [DF__PO_Positor_PO_RowGuid] DEFAULT(NEWSEQUENTIALID()) ROWGUIDCOL,
CONSTRAINT [UX__PO_Positor_PO_RowGuid] UNIQUE NONCLUSTERED([PO_RowGuid]),
CONSTRAINT [UK__Positor] UNIQUE CLUSTERED ([PO_PositorApp] ASC, [PO_PositorHost] ASC, [PO_PositorUID] ASC),
CONSTRAINT [PK__Positor] PRIMARY KEY ([PO_PositorId] ASC)
GO
ssdThe error is in item 7: Returns -1 (SHOULD BE the same PositorId value returned in #2); but no error message is returned or thrown from SSIS.
The error message indicated referential integrity is not upheld when inserting records. This error message occurs AFTER the Execute SQL Task successfully completes; the E.SQL Task returns -1. The executed SQL code will not allow values less than 0
([PO_PositorId] INT NOT NULL IDENTITY(0, 1),)
[Platts Valid [41]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E2F.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80040E2F Description: "The statement has been terminated.".
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80040E2F Description:
"The INSERT statement conflicted with the FOREIGN KEY constraint "FK__PricingPlatts_Posit_PositorId". The conflict occurred in database "Pricing", table "posit.PO_Positor", column 'PO_PositorId'.".
The aforementioned FOREIGN KEY constraint is due to the value being returned by the Execute SQL Task.; therefore, the error lies in the value returned by the Execute SQL Task. -
SQL query returns value but EXEC SQL Task fails to assign variable
I have an execute SQL task to get an identifier from an Oracle database and assign it to a variable (the variable is used in subsequent query's where clauses to transfer the data to a SQL Server database). If I copy the query from the SSIS
package to the Oracle SQL Developer interface and run the query; I get the expected single identifier. If I run the execute SQL task I get the error "[Execute SQL Task] Error: An error occurred while assigning a value to variable "VariableName":
"Single Row result set is specified, but no rows were returned."
I can create phony/simpler versions of the query that will return the wrong identifier that will successfully assign the value to the variable, so the problem isn't with the variable itself or the way the result set is set up in the task (Result
Set/Single Row in the General panel; Result Name 0/VariableName in the Result Set panel).
How can two queries that return a single value produce different results with respect to the variable assignment process?Perhaps you can trap (profile) the query in Oracle to see what it gets submitted,
thing is this query
select id from table where ProcessedStatusColumn is null and DateColumn = (sub select to get most recent date in table where ProcessedStatusColumn is null)
is not guaranteed to return a value, you need a default returned in case the search failed e.g.
select
NVL(id, 0)
from table where ProcessedStatusColumn is null and DateColumn =
(sub select to get most recent date in table where
ProcessedStatusColumn is null)
Arthur My Blog -
Same parameter multiple times in Execute SQL Task
Hi all,
i have a fairly long parametrized query that needs to be run within an Execute SQL task. It has only 2 unique parameters, but these need to be used multiple within that query. The connection is OLEDB.
ill simplify my requirement by making up an arbitrary T-SQL "where" clause that will illustrate what i need:
where
x = @param1
and y = @param1
and z > @param2
and w > @param2
moving this into an SSIS execute SQL task will require the following:
where
x = ?
and y = ?
and z > ?
and w > ?
I know i need to specify 4 parameters and remap the same variables multiple times.. like so:
User:aram1 -> 0
User:aram1 -> 1
User:aram2 -> 2
User:aram2 -> 3
isnt there a better way? i ask this because in my real task i have 2 params, each is reused 4 and 5 times respectively and it seems stupid to repeat params like this.@ _proffy_
you can pass the same variable or value as parameter multiple times sql task.
follow the steps below.
1) type the sql query with parameters in SQL statement tab of sql task editor
2. in the parameter mapping, select the variables.
you can select the same variables more than once.
give the parameter name as 0,1,2,3..... based on variables you require.
do not forget to chooose the appropriate Datatype.
ex:
select * from table1
where a= ?
and b=?
and c= ?
parameters:
Var name param Name
user::Var1 0
user::Var1 1
user::Var2 2
so the value becomes a=var1, b= var1 and c= var2 -
What is the difference between Execute SQL Task and OLE DB Command
Besides the obvious, Execute SQL Task being used in Control Flow, and
OLE DB Command being used in Data Flow what is the difference between the two? Is one supposed to use
Execute SQL Task to produce a result set that then gets handed over to
Data Flow and OLE DB Command ? Everything that I have seen on
OLE DB Command is pretty much execution of a Stored Procedure with ? parameters. It seems as though I got to a point where I had to perform my data edits pretty much entirely in a Stored Procedure executed by
OLE DB Command rather than trying to use the SSIS GUI for everything. I didn't really see in any of my Google searches out there that simply used
OLE DB Command as a straight parameterized SQL against tables for editing and cleansing purposes and handling returns back from SQL Server for COUNT(*), etc..
I know I have posted multiple forums out there regarding this issue but I cannot seem to get a straight answer and some solid direction. So for now, my
Execute SQL Task gives me my editable result set and then control is handed off to
Data Flow and ultimately to my Stored Procedure executed by an
OLE DB Command which pretty much does the chunking for me and performs my data edits and handles my record anomalies through SQL Server Table data stores accordingly or sets flags accordingly if the data passes.
I welcome your thoughts and Thanks for your review and Thanks in advance for any replies and direction that anyone might provide.
Hi ITBobbyP,
OLE DB Command will always process data row by row, whereas Execute SQL task if you call a Stored Procedure it can process data in bulk. As you said, the biggest difference is that Execute SQL Task being used in Control Flow, and OLE DB Command being
used in Data Flow. They are used in different places.
Using Execute SQL Task, we can save the rowset returned from a query into a variable. The Execute SQL task can be used in combination with the Foreach Loop and For Loop containers to run multiple SQL statements. These containers implement repeating control
flows in a package and they can run the Execute SQL task repeatedly. For example, using the Foreach Loop container, a package can enumerate files in a folder and run an Execute SQL task repeatedly to execute the SQL statement stored in each file. I think this
is a big advantage for Execute SQL Task.
As to OLE DB Command, we can easily run an SQL statement for each row transformation in a data flow, then directly insert the outputs to a destination.
To sum up, there are many difference between those two components. We should make better choice based on our actual requirement.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Dynamically change the db and server in execute sql task
Pkg 2: Moves data from B_STG (Staging DB) to B_Det_STG (Staging DB) ---- option1
Pkg 3: Moves data from B_STG (Staging DB) to B_Det (PC DB) ---- option2
This part is duplicating in both the packages
So they want me to merge both of them into in execute sql task and dynamically change between option1 and option2 depending on a pkg level variable.
So, I create a pkg level variable called ExecutionVariable: 'ANALYSIS' or 'LOADING'
If 'ANALYSIS' it needs to do option1 else option2.
So, I ma trying to create a dynamic connection string in execute sql task.
I change the connection property in execute sql task editor dynamically my giving the expression: @[User::ExecutionVariable] == "ANALYSIS"? @[User::STAGINGDBConnectionString] : @[User::PCDBConnectionString]
which evaluates to : Data Source=AW-ETL-D1;Initial Catalog=Staging;Integrated Security=SSPI;Provider=sqloledb
But when I run the sql task, its giving me an error:
ERROR:
TITLE: Microsoft Visual Studio
Nonfatal errors occurred while saving the package:
Error at PC_DataLoad: The connection "Data Source=AW-ETL-D1;Initial Catalog=Staging;Integrated Security=SSPI;Provider=sqloledb" is not found. This error is thrown by Connections collection when the specific connection element is not found.
Error at PC_DataLoad: The connection "Data Source=AW-ETL-D1;Initial Catalog=Staging;Integrated Security=SSPI;Provider=sqloledb" is not found. This error is thrown by Connections collection when the specific connection element is not found.
Can u please help me.Hi ,
Don't try to make the "Execute Sql" task as dynamic.
Try to make OLEDB connection Manager as "Dynamic".
Steps:
1. Create OLE DB Connection pointing to any database then set expression to connection string variables like below.
Provider=SQLNCLI10.1;Integrated Security=SSPI;Initial Catalog=YourDBname;Data Source=YourServerName.
2. Make Delayed Validation property to "True".
3. Set the created dynamic OLE DB connection to your Execute SQL task.
4. Change the connection string variable accordingly before running the "Execute SQL" task.
Hope it will help you.
Regards,
Nandhu -
How to use a parameter in an Execute SQL Tasks in SSDT executed against Netezza
Good Evening,
How can I pass a parameter in an Execute SQL Tasks in SSDT executed against Netezza? Below are my settings and error message.
[Execute SQL Task] Error: Executing the query ""TRUNCATE TABLE" ?"_POC..JOHN_TEST"" failed with the following error: "Syntax error or access violation". Possible failure reasons: Problems with the query, "ResultSet"
property not set correctly, parameters not set correctly, or connection not established correctly.
Thank you in advance for your assistance.
BrettHi Baloun,
Based on my further research, just as you said, we cannot directly use table name as a variable.
To fix this issue, we can change the SQL command in the SQLStatement property as below:
declare @sql varchar(100)
set @sql = 'TRUNCATE TABLE ' + ? +'_POC..JOHN_TEST'
exec(@sql)
go
The Parameter Mapping pane use the former settings in your picture.
Reference:
http://www.bidn.com/blogs/kylewalker/ssis/2063/parameters-don-t-always-work-in-your-execute-sql-task
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Seq. values while loading
Hi ,
Can i generate seq. values while loading records using sql * loader ...
Thanks in Adv.
Ravi Kumar MYes :
SQL> create table test(c1 varchar2(50), c2 number);
Table created.
SQL> create sequence testseq;
Sequence created.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
$ cat test.dat
This is row 1:
This is row 2:
This is row 3:
$ cat test.ctl
LOAD DATA
INFILE 'test.dat'
replace
INTO TABLE test
FIELDS TERMINATED BY ":"
TRAILING NULLCOLS
(c1 char, c2 "testseq.nextval")
$ sqlldr scott/tiger control=test
SQL*Loader: Release 9.2.0.4.0 - Production on Tue Nov 22 11:14:49 2005
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Commit point reached - logical record count 3
$ sqlplus scott/tiger
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Nov 22 11:14:53 2005
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
SQL> select * from test;
C1 C2
This is row 1 1
This is row 2 2
This is row 3 3
SQL>
Maybe you are looking for
-
Creating a "West Wing Effect"?
this really got nothing to do with FCP. But I'll see if I can get any help here anyway! I've been watching West Wing, and I'm very impressed with the glow they create around all objects that are white when they're in the "west wing". For example, whi
-
I have the 60g iPod video, how come I get a message that says: "Firewire Connectios are not supported. To transfer songs connect the USB cable provided." Doesnt that seem a tad rediculous when every other generation was able to use the firewire conne
-
How to install firmware upgrage (WRT54G2 v1)
I have Linksys model WRT54G2 v1, firmware 1.0.01. I have not changed any of the default settings (except at the Wireless tab, I have selected Disable -- two computers use the router, both are connected by cables, so I do not use the wireless capabili
-
Powershell Event - email notification / stop / restart question
Hey guys, I have a filesystemwatcher app running to process files to a sql and ms access database. It works fairly well. However sometimes it goes down for really no particular reason that i can tell. So im trying to do two things if at all po
-
I'm pretty sure the IR port on the Powerbooks was for data transfer, and I was wondering if anyone knows if it's possible to sync my Palm through it. My USB cable for the Palm broke, and I know the Palm is capable of IR sync. What I don't know is if