ExecuteSQL Task With Parameters

Jul 14, 2005

I have an insert statement that i am trying to parameterize based on a variable.  I have tried:

View 23 Replies


ADVERTISEMENT

ExecuteSQL Task Has Changed

Jun 19, 2005

Since the last IDW.

View 10 Replies View Related

ExecuteSQL Task Fails And I Think It Should Not

Jun 19, 2005

I setup my ExecuteSQL task to have a "Single Row" resultset.  The query returns no rows.  It fails.  I don't think it should but then maybe this is consistent with the lookup transform piping rows down the error output if there is not a lookup value returned.

View 9 Replies View Related

PackageID And GUIDs In ExecuteSQL Task

Jan 18, 2006

Am I looking at a potential bug here or do I not understand the feature properly? I have an ExecuteSQL task that inserts into a table for logging and includes the System::PackageID as one of the values. It's stored in my table as a uniqueidentifier. When I set the output variable in Parameter Mappings tab of the Execute SQL task to VarChar, all works great. WHen I set it to GUID as the data type in that tab, it outputs a different GUID than the actual System::PackageID variable.

-- Brian

View 1 Replies View Related

Logging Query Messages From ExecuteSQL Task

Dec 15, 2006

The ExecuteSQL task makes it easy to capture the resultset of a query or stored proc in a variable. But what about the messages that would normally appear in the Messages tab when running queries in Management Studio or Query Analyzer? There must be a way to display and log rowcounts and other messages that a query normally produces.
 
Various package/task logging configrations haven't helped. I've read discussions about logging rowcounts in data flow tasks, but what about capturing messages in ExecuteSQL and other control flow tasks that run T-SQL?
 
I only have enough time to dabble in this technology so I may be missing something obvious or approaching this incorrectly. Any suggestion, reference, constructive criticism or reponse would be appreciated.
 

View 15 Replies View Related

Getting Permission Denied Error In ExecuteSQL Task

Aug 21, 2006

The purpose of the Package is to load an SQL table with data from text files in a subdirectory. The parameter is parsed from the text filenames. It is a zipcode.

I have an ExecuteSQL task inside a ForEach container. The SQL in the task is:

IF EXISTS (SELECT * FROM dbo.ZipCodeRadius
WHERE CenterPostalCode = ?1)
BEGIN
DELETE FROM dbo.ZipCodeRadius
WHERE CenterPostalCode = ?1
END

I also have a Data Flow task in this container which populates the ZipCodeRadius table. The same parameter is also passed to the Data Flow task which specifies a zipcode to delete and afterward load.

I am using Windows authetication for the package.
What am I doing wrong?

Fred

View 21 Replies View Related

Error Occurring In ExecuteSQL Task In OnPreExecute (and In OnPostExecute) But Package Not Failing

Jun 5, 2006

When any of
my tasks or script tasks in my control flow, or data flow, have an
error, the entire package, and then the calling package fail, as far as
I've seen, through some CTP versions, beta versions, and the release
version of SQL Server 2005.

But, I've just made a change, in an
sproc called from an ExecuteSQL Task in a PreExecute event attached to
a DataFlow, and that ExecuteSQL Task is reporting an error in the
output window, but the package execution is not being stopped. Why not?

I see something like so

Error: 0xC002F309 at MyExecuteSqlTaskName, Execute SQL Task: ....
Task failed: MyExecuteSqlTaskName
Warning:
0x80019002 at OnPreExecute: The Execution method succeeded, but the
number of errors raised (1) reached the maximum allowed (1); resulting
in failure. This occurs when the number of errors reaches the number
specified in MaximumErrorCount. Change the MaximumErrorCount or fix the
errors.

repeated many times in the output stream, and the same thing for the PostExecute event attached to the same object.

I'm disappointed, because I want errors propagated upwards, as I'm used to.

I
looked, and as far as I can tell, all my ExecuteSQL tasks (in events
and in the regular control flow) have the default settings of

FailPackageOnFailure: False
FailParentOnFailure: False
MaxErrorCount: 1


Do
I have to go revise these settings on every ExecuteSQL Task in every
event handler in every SSIS package? (That will be exceedingly
tedious.) Do I set these on the ExecuteSQL task inside the event? Do I
set these on the event handler itself?

View 3 Replies View Related

Character Len Probelm With Executesql

Jun 15, 2007

I need to create some tables dynamically using sp_executesql. But the problem is the length of sql string is more the 4000 characters. How can I solve this problem?
Thanks

View 3 Replies View Related

SSIS ExecuteSQL Wierd Error

Feb 13, 2007

hi all!

i have encountered an inconsistent error while creating packages programatically. i am trying to create an ExecuteSQL Task like this:

ExecuteSQLTask sqlTask = (ExecuteSQLTask)sqlTaskHost.InnerObject;

and somtimes it failes on this command with this error:

<Message>Error in generating package C:PROJECTSPOSTALBuildSSIS packagesMappingsMappingsSBSCR_52_OUT.dtsx</Message>

<InnerException>Type 'Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ExecuteSQLTask' in Assembly 'Microsoft.SqlServer.SQLTask, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' is not marked as serializable.</InnerException>

<Data />

<Source>mscorlib</Source>

<HelpLink />

<StackTrace> at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)

at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)

at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()

at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)

at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)

at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)

at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)

at System.Runtime.Remoting.RemotingServices.MarshalToBuffer(Object o)

at Microsoft.SqlServer.Dts.Runtime.ObjectHostImpl.get_InnerObject()

at Microsoft.SqlServer.Dts.Runtime.TaskHost.get_InnerObject()

at InterfaceEngine.OutputInterface.CreateExcel() in C:PROJECTSPOSTALBuildInterfaceInterfaceEngineInterfaceEngineOutputInterface.cs:line 842

at InterfaceEngine.OutputInterface.GenerateOutputPackage() in C:PROJECTSPOSTALBuildInterfaceInterfaceEngineInterfaceEngineOutputInterface.cs:line 322</StackTrace>

<TargetSite />



what is this about? why does it happen , and why not always? the package generation is generated by a web service that is called from an asp.net 2.0 page .



thanks a lot!!!

View 4 Replies View Related

ExecuteSQL Using Variable Expression And Comments

Nov 16, 2007

I have been successful using comments (to help remind me that the SQL is coming from a varaible which is set via an expresion) within the variable expression passed to a Source or Destination. I have been unable to get this to work in an ExecuteSQL control flow task when parameters are used within the query. I am not sure what is causing this not to work the fact that it is an ExecuteSQL control flow task or that the SQL has parameters (or perhaps that it also uses an OUTPUT parameter).

Any thoughts to share? Am I missing something?

WORKS (In Data Flow SQL):
"--NOTE: This is defined by an expression on Source_AdventureWorks_Customers_SQL variable
SELECT
[CustomerID],
[TerritoryID],
[AccountNumber],
[CustomerType],
[rowguid],
[ModifiedDate]
FROM
[AdventureWorks].[Sales].[Customer]"

FAILS (in Control Flow ExecuteSQL with parms including Output parm):
"--NOTE: This is defined by an expression on Source_AdventureWorks_Customers_SQL variable
[audit].[up_LogEtlPackageStart]
@ETLAuditParentKey = ?,
@Description = ?,
@PackageName = ?,
@PackageGuid = ?,
@PackageVersionMajor = ?,
@PackageVersionMinor = ?,
@PackageVersionBuild = ?,
@MachineName = ?,
@ExecutionGuid = ?,
@LogicalDate = ?,
@StartTime = ?,
@Operator = ?,
@ETLAuditKey = ? OUTPUT"

WORKS (in Control Flow ExecuteSQL with parms including Output parm):
"[audit].[up_LogEtlPackageStart]
@ETLAuditParentKey = ?,
@Description = ?,
@PackageName = ?,
@PackageGuid = ?,
@PackageVersionMajor = ?,
@PackageVersionMinor = ?,
@PackageVersionBuild = ?,
@MachineName = ?,
@ExecutionGuid = ?,
@LogicalDate = ?,
@StartTime = ?,
@Operator = ?,
@ETLAuditKey = ? OUTPUT"


View 7 Replies View Related

ExecuteSQL Using SQLSource Variable And Output

Nov 16, 2007



Really stuck trying different ways to get a string variable (expression based) to parse and run correctly in an ExecuteSQL task. Would someone be able to advise why one of the following methods works and the other does not?
I'd really prefer to have the second currently not working method be used if possible.

WORKS:
"[audit].[up_LogEtlPackageStart]
@ETLAuditParentKey = ?,
@Description = ?,
@PackageName = ?,
@PackageGuid = ?,
@PackageVersionMajor = ?,
@PackageVersionMinor = ?,
@PackageVersionBuild = ?,
@MachineName = ?,
@ExecutionGuid = ?,
@LogicalDate = ?,
@StartTime = ?,
@Operator = ?,
@ETLAuditKey = ? OUTPUT"

FAILS:
When the variable expression is set as follows I :



Code Block

"[audit].[up_LogEtlPackageStart]
@ETLAuditParentKey = " + (DT_WSTR, 100)@[User::ETLAuditParentKey] + ",
@Description = " + (LEN( @[User::PackageDescription]) == 0 ? "' '" : @[User::PackageDescription]) + ",
@PackageName = " + @[System::PackageName] + ",
@PackageGuid = " + @[System::PackageID] + ",
@PackageVersionMajor = " + (DT_WSTR, 100)@[System::VersionMajor] + ",
@PackageVersionMinor = " + (DT_WSTR, 100)@[System::VersionMinor] + ",
@PackageVersionBuild = " + (DT_WSTR, 100)@[System::VersionBuild] + ",
@MachineName = " + @[System::MachineName] + ",
@ExecutionGuid = " + @[System::ExecutionInstanceGUID] + ",
@LogicalDate = " + (DT_WSTR, 100)@[User::LogicalDate] + ",
@StartTime = " + (DT_WSTR, 100)@[System::StartTime] + ",
@Operator = " + @[System::UserName] + ",
@ETLAuditKey = " + (DT_WSTR, 100)@[User::ETLAuditKey] + " OUTPUT"




This method generates a "Syntax error, permission violation, or other nonspecific error. Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly"

Any ways to get the second failing expression to work?
Is this a problem due to the OUTPUT parameter?
THANKS!

View 7 Replies View Related

DTS SQL Task Parameters Error

Feb 16, 2006

I have an odd problem with the parameters in a SQL task.

I created a DTS package with an SQL task that uses a parameter marker in the WHERE cause. The value comes from a Global Var. The package runs fine but when I try to access the parameter mapping page I get this:

Syntax Error or Access Violation Error

Anybody know what to do about this?
It's not very efficient to have to rebuild the task every time I need to add a parameter.

Thanks

View 1 Replies View Related

Parameters And Execute SQL Task

Apr 2, 2008

I know you can pass parameters into a Direct Input and a Stored Proc in the Execute SQL Task Editor, but can you pass parameters to a File Connection? If so, then how would I do that?

Thank you,

Steve...

View 5 Replies View Related

Parameters In Execute SQL Task After SP2

Apr 25, 2007

Hi,



we have a Package, that worked fine for a long time. Now, it always fails on all computers with SP2 instaled. The problem apears in execute sql task, which uses ole db connection manager and calls a procedure with some input parameters (from sql server).

Package sends a undesirable data (".") into the procedure from variable, which has NULL or Empty string value. Originaly, data type of the Variable was Object, I tried to use also string, but in both cases the procedure was called with parameter "."



Please, can anybody tell me what's wrong?



Thanks



Janca

View 2 Replies View Related

SQL Task - Passing Parameters

Feb 20, 2006

Hello,
I have a SQL task wich executes the following statement on a OLEDB connection (SQL 2005 DB):

TRUNCATE TABLE DimTime
GO

DECLARE @CurrentDate AS Datetime
DECLARE @EndDate AS Datetime

SET @CurrentDate = '10-20-2003';
SET @EndDate = '10-20-2005';

while(@CurrentDate < @EndDate)
begin
INSERT INTO DimTime SELECT
DATEPART(month, @CurrentDate) AS MonthNumberOfYear
,DATEPART(quarter, @CurrentDate) AS CalendarQuarter
,DATEPART(year, @CurrentDate) AS CalendarYear
,dbo.GetSemester(DATEPART(month, @CurrentDate)) as CalendarSemester
,DATEPART(quarter, @CurrentDate) AS FiscalQuarter
,DATEPART(year, @CurrentDate) AS FiscalYear
,dbo.GetSemester(DATEPART(month, @CurrentDate)) AS FiscalSelester

set @CurrentDate = dateadd(month, 1, @CurrentDate)
end
GO

Now I want to parametrize the statement creating an external variable:

1. I created a datetime package variable (DimTimeStartDate)

2. Add update the above SQL statement to

SET @CurrentDate = ?;

3. I mapped the package variable to a new parameter (name 0)

Executing I get the following error:

[Execute SQL Task] Error: Executing the query " DECLARE @CurrentDate AS Datetime DECLARE @EndDate AS Datetime SET @CurrentDate = ?; SET @EndDate = '10-20-2005'; while(@CurrentDate < @EndDate) begin INSERT INTO DimTime SELECT DATEPART(month, @CurrentDate) AS MonthNumberOfYear ,DATEPART(quarter, @CurrentDate) AS CalendarQuarter ,DATEPART(year, @CurrentDate) AS CalendarYear ,dbo.GetSemester(DATEPART(month, @CurrentDate)) as CalendarSemester ,DATEPART(quarter, @CurrentDate) AS FiscalQuarter ,DATEPART(year, @CurrentDate) AS FiscalYear ,dbo.GetSemester(DATEPART(month, @CurrentDate)) AS FiscalSelester set @CurrentDate = dateadd(month, 1, @CurrentDate) end " failed with the following error: "Syntax error, permission violation, or other nonspecific error". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Not clear what is wrong. Any help ?

Thanks,
Pierre

View 12 Replies View Related

Parameters In Sql Task Sub Query

Oct 9, 2006

DELETE T1
WHERE EXISTS
(SELECT *
FROM T2 A
WHERE A.C1= T1.C1
AND A.C3 >= ?)


Results in below error (OLEDB SQL TASK):

" failed with the following error: "Parameter Information cannot be derived from SQL statements with sub-select queries. Set parameter information before preparing command.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Any resolution?

View 9 Replies View Related

DTS Parameters In &#39;execute SQL Task&#39; SQL Server 2k

Jan 8, 2002

Hi

SQL server 2000 DTS Problem

I'm trying to pass the value of a global variable
as an input parameter in a 'execute sql task' DTS object.

However, SQL refuses to accept the global variable
assigned to the input parameter '?'. When you run the
DTS package the error message 'no value given for one or
more parameters' appears.

When you save / exit the DTS object by clicking OK, and then go
back into it, the 'input Global variables'
parameter field is empty again.
Searched msdn/knowledgebase to no avail - please help ! Thanks






Help much appreciated please !

View 6 Replies View Related

Problem Exec SP With Parameters In SQL Task

Jan 12, 2008

Hello,
I am trying to use an Execute SQL Task to execute a stored procedure with parameters in SSIS but it keeps giving me errors, for example I type in 'exec someproc ?, ?, ?' in SQL Task it wouldnt parse correctly and when I set the bypassPrepare to 'true' the package runs but gives me error at the destination saying couldnt find stored procedure 'someProc'.

Does anybody know how I can solve this problem?

Also how do I pass the results of the queries in the Execute SQL Task into the Data Flow Task? The proc is supposed to retrieve data and transform them into XML format to be placed at a XML file. I am not sure if I should used an OLEDB source or an XML source since the data has been transformed into XML. Any help will be greatly appreciated.

View 1 Replies View Related

Execute SQL Task: UDF Not Taking Parameters

Sep 20, 2007

Hi,


I have an Execute SQL Task in my SSIS Package.
Now, this Execute SQL Task has the following query (Connection Type is OLE DB):




Code SnippetSELECT dbo.udf_CommonDateTime_Get (GetDate(), ?) As User_Datetime





I want 2 things from this Task:
1) It should take the 2nd argument to the UDF from a variable.
2) It should store the value returned by this SELECT statement into another variable.


So, I go ahead and modify the Parameter Mapping for the Task. Here I add the Input variable name, Data type and I give the Parameter Name as 0.


I also modify the Result Set for the Task. Here, I specify the Result Name as User_Datetime and give the appropriate Variable Name.


I am getting an error here and I believe it is due to the input parameter. The UDF is not getting the 2nd argument correctly.


My questions:
1) Has the Execute SQL Task been designed to handle UDFs like this. If not, then where am I going wrong?
2) What is the work-around for this? I need to pass a parameter (variable) to the UDF.


Thanks in advance.


Regards,
B@ns

The error message is:



Code Snippet
Execute SQL Task: Executing the query "SELECT dbo.udf_Common_DateTime_Get (GetDate(), ?)
As User_Datetime" failed with the following error: "Syntax error, permission violation, or other nonspecific error". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Task failed: Set UserDateTime

View 5 Replies View Related

DTS Package: Execute Process Task && Parameters

Jul 27, 2004

Hello,

I have several DTS packages that take data from SQL Server and exports them onto an Access DB located on the network. Basically, one Execute Process Task from within my DTS package takes the Access DB and zips it while another such task copies the zipped DB and pastes it onto another location on the network. All this works fine.

This export process happens once a month so each month I have to manually add a datestamp to the end of the Access DB file that’s being exported to distinguish it from prior month's export. For example, this month's export file would have AccessDB_20040727.mdb name and the next month it would be AccessDB_20040820.mdb (date is determined based on the date the output is exported on). AccessDB.mdb is the default name of the export DB and datestamp is added at the end of the file name depending on what date the export was run. As I said, I can do this manually each month and it works fine.

I want to, however, know if there is a way to automatically supply the datestamp to the Execute Process Task's Parameters' text box? Following is what I have right now in the Parameters box:
\ghf1-ndc8-sqll$productionoutputlob200406LOB_CF_forDril ldown_All_20040727.zip \ghf1-ndc8-sqll$productionoutputlob200406LOB_CF_forDril ldown_All.mdb

I want to take above text from the parameters box and replace it with something like:
\ghf1-ndc8-sqll$productionoutputlob200406FileName_RunDa te.zip \ghf1-ndc8-sqll$productionoutputlob200406LOB_CF_forDril ldown_All.mdb

Where FileName_RunDate is a variable/placeholder for the name of the output with the datestamp the output is exported on.

There are three different Execute Process Tasks that are happening within each of my DTS packages so it's a time consuming job to have to manually add a datestamp to each package every month when data is exported.

Does anyone know if what I am asking is doable? If I can use a variable in the parameters box of each Execute Process Task’s properties and supply current datestamp values to it prior to executing the package each month? If so then what are the ways? How would I do that?

Thanks much.

JN

View 2 Replies View Related

Using Package Variables As Parameters In Execute Sql Task

Feb 23, 2006

Hi,

I need to run an SQL command, in which one of the fields is based on the current time, represented as a string in a specific format.

I used a script task to create the string from the current time, and store it in a package variable named "newDate". Later, in the execute sql task, I have the following update statement: "update table_1 set field_1 = ?" (OLE DB connection is used)

and in the parameters mapping I set parameter 0 to the string package variable "newDate".

The problem is that on runtime, the sql executes with the default value of the variable - i.e. it doesn't take the new value.

I checked it and placed another script task after the first one, that simply tries to read the variable "newDate" and print it to screen, but even here the default value is used.

how can I use the new value of the variable?

thanks.

View 7 Replies View Related

SSIS Web Service Task Input Parameters

Nov 7, 2006

There is not a way to pass parameters to input of Web Service tasks. I heard this problem is fixed with SQL2K5 SP1 and even the online doc says that one can choose either "value" or "variable" when specifying input for web service tasks, but after I installed what-I-think-is SP1, there is still no way to do this.

If one can only specify values (hard-coded) as input to web service tasks, then this would be a very severe limitation. I hope I'm wrong, so could someone please give a pointer. Thanks

Kevin Le

View 7 Replies View Related

How To Pass Parameters Into Data Flow Task

Jul 18, 2007

I have a DTS package of SQL server 2000 which has two "Execute SQL Task", which gets maximum ID (call it maxID1) from table1 in mysql and maximum ID (call it maxID2) from table 2 in sql server. Those 2 as global variables passes into a data flow which grabs all data from mysql's table1 with its ID > maxID2 and ID <= maxID1 and insert into SQL server table3. This package is working so far.



My question is how to achieve the same thing in SSIS? I created two "Execute SQL Task", which will get maxID1 and maxID2, and one "Data Flow Task". But how to pass those 2 parameters into that "Data Flow Task" without using "Script Task"?



Anyone could help? Thanks!

View 4 Replies View Related

Executing Stored Procedure With Parameters Using Execute Sql Task

Jul 12, 2006



Hi ,

I am trying to exectue a stored procedure through execute sql task which takes two input parameters table name and filegroup to create a table and it also returns a value.

i am using the oledb connection

but i am getting the following error



[Execute SQL Task] Error: Executing the query "declare @rtn_value int exec spm_Utopia_FinanceUsage_Create_MonthlyTable ?,? select @rtn_value as rtn_value " 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.



i tried with ado.net connection by directly giving the parameter names.

it will create a table but the the table name is something different from what i specified



Please do help as soon as possible



Thanks

Manish



View 2 Replies View Related

Why Doesn't The Execute Package Task Support Parameters?

Aug 29, 2007



[Microsoft follow-up]

dtexec.exe allows us to pass values into a package using /SET and a property path. Why can't we do the same using the Execute Package Task?

And yes, I know about Parent Package Configurations, I use them alot. But I would still like the ability to pass values in.

-Jamie

View 11 Replies View Related

Passing Parameters To SSIS Execute Process Task

Feb 20, 2008

Hi

Can anyone help me in for the following.

i want to execute a exe file with two variable parameters

Executable : C: empMyExe.exe
Parameter1 : User::Category type is string (below example A)
Parameter2 : User::Amount type is string (below example 1)

in dos it looks like this
c: empMyExe A 1

This will executes fine.

Thanks,
Madhu

View 1 Replies View Related

Dynamically Changing Web Service Task Parameters At Runtime?...

Aug 15, 2005

Okay, this one might stump you guys.

View 3 Replies View Related

Execute SQL Task Passing Parameters To A Restore Command

Mar 22, 2007

Hi,

I'm very new to SSIS and I€™m trying to do the following in a SQL task

RESTORE DATABASE @DatabaseName FROM DISK = @Backup WITH FILE = 1, MOVE @OldMDFName TO @NewMDFPath, MOVE @OldLDFName TO @NewLDFPath, NOUNLOAD, REPLACE, STATS = 10

I'm using an OLE DB connection and I have mapped user variables to the various parameter names. Unfortunately when i test the above command it fails on must declare the scalar variable "@DatabaseName". How can i get my values to be substituted into the command?

Many thanks

Martin



View 4 Replies View Related

Multi-parameters Issue In Data Flow Task SSIS

Dec 4, 2006

Hi all,

I met a problem when trying to pass values to a SQL statement through parameters. It's a data flow task. I used the OLE DB connection. My statement is like the statement below(the real statement is little complex):

Select * from myTable where mydate>? and mydate<?

I used the "set query parameter" dialogbox to bulid two parameters varStartTime and varEndTime, the values for the two parameters were set to "1/1/2005" and "12/30/2006" respectively. But when I click the "Parse query" button, I got errors

Parameter Information cannot be derived from SQL statements. Set parameter information before preparing command.

I have referred to the posts, but the problem still exists. Any help will be highly appreciated. Thanks a lot!

View 1 Replies View Related

How To Pass Values To A Stored Procedure Parameters By Using Script Task

Nov 27, 2007



Hi All,

I have One package that it contains one Execute SQL task in that i have placed a Stored procedure .
Now i want to pass values to Stored procedure parameters from a databse table by dynamically .For this i am trying to use " Script task "
How can i pass that table column values to that stores procedure thru using Script Task?

Regards,
Maruthi..

View 3 Replies View Related

Problems In Mapping Parameters Of Type Int64 To The Execute SQL Task

Dec 31, 2007

Good day everyone,


I have a question concerning the Execute SQL task.


Problem Statement:
I have a table containing the following sample data.


Catalog_ID, Product_ID, IsBlocked
56789, 1, 0
56789, 3, 1
23567, 1, 0
23567, 2, 1


The data types of the fields are:
Catalog_ID: bigint
Product_ID: bigint
IsBlocked: bit


I have two variables called "old_catalog_id" and "new_catalog_id" with the following values:
old_catalog_id: 56789
new_catalog_id: 11111


Now, I would like to select all the recods, whose Catalog_ID fields equals the value in the variable "old_catalog_id" and insert identical recods with the "new_catalog_id" value.

The result of that operation on my sample records is:

Catalog_ID, Product_ID, IsBlocked
56789, 1, 0
56789, 3, 1
23567, 1, 0
23567, 2, 1
11111, 1, 0
11111, 3, 1

blue: selected fields
green: inserted fields


My Solution:
In order to realize this solution, I have created the following tasks on the Control Flow.

1. Create an Execute SQL Task for the selection. (Name: Selection Task)
2. Create a For-Each-Loop for iterating on the result set. (Name: Loop on results Container)
3. Create an Execute SQL Task inside the For-Each-Loop container for inserting the new records. (Name: Insertion Task)


Configurations and Problems:
1. Selection Task:
General Tab:
Result Set: Full Result Set
SQL Statement:
select Product_ID, IsBlocked
from MyTable
where Catalog_ID = ?


Parameter Mapping Tab:
Variable Name -- Direction -- Data Type -- Parameter Name
User:: old_catalog_version -- Input -- Large_Integer -- 0


Result Set Tab:
Result Name -- Varibale Name
0 -- User::FullResultSet (which has the Data Type: Object)


When I execute this task, I get no records.
Thus, I have hard-coded the value of Catalog_ID in the Sql Statement parameter. Now, I get the correct 2 records in the result set.
Question 1: What am I doing wrong in the Parameter Mapping?


2. Loop on results Container:
Collection Tab:
Enumerator: Foreach ADO Enumerator
ADO object source variable: User::FullResultSet
Enumeration mode: Rows in the first table


Variable Mappings Tab:
Variable -- Index
User:: old_prod_id -- 0 (Data Type of "old_prod_id" is Int64)
User:: old_isBlocked -- 1 (Data Type of "old_isBlocked" is Boolean)


When I execute the package, it fails with the following error message:
Error: 0xC001F009 at SQL Tasks: The type of the value being assigned to variable "User:: prod_id" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.

Thus, I have changed the data type of the variable "old_prod_id" to Object. Now, the package runs successfully.


Question 2: Why isn't the package accepting "Int64" as the data type of my variable, although the corresponding DB field has the type "bigint"?


3. Insertion Task:
General Tab:
Result Set: None
SQL Statement:
insert into MyTable
(Catalog_ID, Product_ID, IsBlocked)
values (?, ?, ?)


Parameter Mapping Tab:
Variable Name -- Direction -- Data Type -- Parameter Name
User::new_catalog_version -- Input -- Large_Integer -- 0
User:: old_prod_id -- Input -- Large_Integer -- 1
User:: old_isBlocked -- Input -- Variant_Bool -- 2


When I execute this task, it fails with the following error message:
Error: 0x0 at Insertion Task: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Catalog2Context_CATALOGS". The conflict occurred in database "XS_EC_CCH_PEGXSAP2", table "eSearch4.CATALOGS", column 'ID'.


Well, the message implicitly states that the value of the variable "new_catalog_version" has violated the mentioned FOREIGN KEY constraint. But I have set a breakpoint and I saw that the value was set correctly. So, it seems that the Execute SQL Task is not able to read the value of the variable correctly.


Question 3: What am I doing wrong in the Parameter Mapping, which causes the task not being able to read the value of the variables correctly?


Thanks in advance for your help.


Regards,
Samar

View 3 Replies View Related

Parameters In Data Flow Task With Oracle Database Source

Jul 9, 2006

In many DTS packages I have used parameterised queries for incremental loads from Oracle database sources using the Microsoft ODBC Driver for Oracle.

Now I want to migrate these packages to SSIS, but the OLE DB connection for Oracle does not support parameters.

I cannot use the "SQL command from variable" data access mode because of the 4000 character limitation on the length of string variables and expressions.

Am I missing an obvious workaround?

View 7 Replies View Related

Integration Services :: Pass Parameters To SSIS Execute Process Task?

Nov 3, 2015

Got a powershell script to split a large XML file to split in smaller chunks. I have Execute ProcessTask in SSIS with: 

Executable: %windir%system32WindowsPowerShellv1.0powershell.exe

argument: -ExecutionPolicy ByPass -command ". 'C:WorkspacesSplitToytPMFile.ps1'"

I need to pass File Name as parameter to the PS script. I tried using the StandardInputVariable but it doesn't work. 

View 11 Replies View Related







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