Table Name As A Parameter On Execute SQL Task?
Jun 22, 2006
Is it not possible to have table name as a parameter? For example have the SQL something like:
Delete From ? Where ID = ?
.. I get error:
[Execute SQL Task] Error: Executing the query "Delete From ? Where ID = ?" failed with the following error: "Must declare the table variable "@P1".". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
View 5 Replies
ADVERTISEMENT
Dec 2, 2005
I have a SQL Task that calls a stored procedure and returns an output parameter. The task fails with error "Value does not fall within the expected range." The Stored Procedure is defined as follows: Create Procedure [dbo].[TestOutputParms] @InParm INT , @OutParm INT OUTPUT as Set @OutParm = @InParm + 5 The task uses an OLEDB connection and has a source type of Direct Input. The SQL Statement is Exec TestOutputParms 7, ? output The parameter mapping is: Variable Name Direction Data Type Parameter Name User::OutParm Output LONG @OutParm
View 7 Replies
View Related
Nov 7, 2006
I am trying to create an Execute SQL task that sets a variable.
This is my SQL
DECLARE @Period AS DATETIME
SET @Period =Parameter0 + '/01/' + Parameter1
SET @Period = DATEADD(m, -1, @Period)
SELECT DATEADD(s, -1, @Period)
This statement parses okay.
I mapped two variables called "User::PeriodMonth" and "User::PeriodYear" in the Parameter Mapping tab to the parameters.
In the Result Set tabl I have mapped a variable "User::PeriodStartDate" to Result Name "PeriodStartDate".
The error I get is the following:
[Execute SQL Task] Error: Executing the query "DECLARE @Period AS DATETIME SET @Period =Parameter0 + '/01/' + Parameter1 SET @Period = DATEADD(m, -1, @Period) SELECT DATEADD(s, -1, @Period) " failed with the following error: "Parameter name is unrecognized.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
The Online Books are not helpful. They just say you have to bind the parameters to the application variables.
What am I doing wrong?
I want to set another variable called "PeriodEndDate" also. Can both variables be set in the same task?
View 12 Replies
View Related
Apr 17, 2008
I have 2 questions on this
(1) I know how to use the ? ? ? and 0, 1, 2 notation in Parameter Mapping within Execute SQL Task. However, the interface allows me to give descriptive names to my parameters (other than the ordinals 0, 1, 2, ...). To be more clear, if you go into Parameter Mapping and click in Parameter Name column, you are not just restricted to typing in 0, 1, 2, ... You can type anything you want for the name. Does this suggest that I can use other things besides a "?" in my SQL command?
(2) What is Parameter Size? Is this like a data type? If so, why am I allowed to type in anything I want in there?
View 3 Replies
View Related
Dec 13, 2007
Hi All,
I am using a stored procedure defined as follows:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[GetPriority] @PriorityID TINYINT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SELECT [Priority]
FROM [MTD Dashboard].[dbo].[Priority] WHERE [Priority ID]=@PriorityID
END
I want to use this stored procedure in a Execute SQL Task. What should be the SQL Statement, Parameter mappings and Result Set?
Can someone please help me in doing this.
Thanks
View 5 Replies
View Related
Mar 9, 2006
I am trying to assign the same package variable value to three different parameters in a query. The variable contains the name of a database which the user will input during package execution. First I check to see if the database exists (if it does I drop it), then in either case I create the database. See code:
if exists
(
select name
from sys.databases
where name = ?
)
begin
drop database ?;
end;
go
create database ?;
go
This is the error I am getting:
[Execute SQL Task] Error: Executing the query "if exists ( select name from sys.databases where name = ? ) begin drop database ?; 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.
My "User::DestinationDatabase" variable is mapped to 0,1,2 using an OLE DB connection. Any suggestions would be welcome.
Regards,
DO
View 13 Replies
View Related
Mar 20, 2008
Hi All,
I have a Doubt in Parameter Passing in Execute SQL Task.
In Execute SQL Task, I have an Insert query in which I want to pass the Database Name Dynamically i.e. passing it as a parameter.
Eg.
The query is --------- Insert into [?].[dbo].[DimCurrency] values( value1, value2, value3)
I want to pass this Database name using a user variable. But I am not able to do so.
What is the catch in this, Can anybody please help me out.
Thanks & Regards,
kapadia Shalin P.
View 5 Replies
View Related
Jun 18, 2007
I have a stored proc which starts like this:
CREATE PROCEDURE dbo.AddAttachmentListItem
@ListID uniqueidentifier,
@AttachmentPath varchar (260),
@DeleteAttachmentAfterSend bit = 0
I have a Script task which generates a GUID and stores it in the variable @[User::AttachmentListId], which is of type System.Object since Guid wasn't an option. Following this is an Execute SQL task (with an OLE DB connection to an SQL Server 2000 database) whose SQL statement is
EXEC AddAttachmentListItem ?, ?, 0
My parameter mapping looks like this (variable name, direction, data type, parameter name, parameter size):
@[User::AttachmentListId], Input, GUID, 0, -1
@[User::AFilePath], Input, VARCHAR, 1, 260
When I execute my package I get the following error:
[Execute SQL Task] Error: Executing the query "EXEC AddAttachmentListItem ?, ?, 0" failed with the following error: "The type is not supported.DBTYPE_GUID". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
This worked earlier when the first parameter was an int and not a uniqueidentifier, but I reworked my design because the GUID was a better choice for what I was doing. Well, at least 'til I got to this point....
Any ideas?
View 6 Replies
View Related
Mar 3, 2007
hi
I would like to create a SSIS package that is going to be called by store procedures.
What i have done so far.
1) I created a Execute SQL task that come with this statement e.g. Seleect * from tblA where BD >= ? and BD =< ?
2) I save this package as a DTSX file and will called it from a proc.
My intention is to pass 2 values when i call the proc. What should do next? any guided tutorial or steps i would be happy. thanks
View 1 Replies
View Related
Feb 28, 2008
Hi all,
I'm trying to capture the OUTPUT from Execute Sql task...However when I run, the parameter didn't seem to capture the OUTPUT.
In my Sql Task, the parameter mapping:
Variable name: user::variable,
direction: OUTPUT,
Data Type: Varchar,
parameter name: 0,
parameter size: -1
connectiontype: OleDB
sourcetype: direct input
statement ELECT columnx FROM table1 WHERE (columnID=
(SELECT MAX(columnID) ASID
FROM table1 A)
I could be misunderstood on how Execute sql task work on Output.
thanks
View 5 Replies
View Related
Aug 6, 2015
In temp table there rae data which start with 1 and 2.I want to select only those record which start with 1 Zone is a parameter to the Execute sql task in ssis package..I have created sample code to test when I am running my query I am not getting anything
create table #temp
( zoneid bigint
)
insert into #temp values(100000000000000000)
insert into #temp values(100000000000000000)
insert into #temp values(100000000000000000)
insert into #temp values(100000000000000000)
insert into #temp values(200000000000000000)
insert into #temp values(200000000000000000)
[code]...
View 6 Replies
View Related
Apr 26, 2008
I have a SSIS Execute SQL Task that calls a stored procedure with a date parameter. The text of the stored procedure is an "INSERT INTO .. SELECT ..." statement. When I run the text in Query Analyzer, it completes successfully. When I call the Stored Procedure, it executes but does not insert the data. Setting ByPass Prepare to True does not affect the outcome. I also used the query directly in the SQL task itself to no avail. Executing the query in Query Analyzer works. Any assistance would be greatly appreciated.
Dan
View 6 Replies
View Related
Feb 5, 2006
Hi all,
As part of the logging process for data input, I want to update two fields in a logging table. The first is a datetime, derived from looking up the maximum value in another table (the table I've just imported), and the second is an integer - the number of rows captured in a variable during the task.
I can do this in two separate Execute SQL tasks as follows:
Task 1 syntax
DECLARE @maxDate datetime
SELECT @maxDate = max(dtLastChangedDate)
FROM dbo.tblCancel_RAW
UPDATE dbo.tblLogging
SET PreviousFilterValue = CurrentFilterValue,
CurrentFilterValue = ISNULL(CAST ( @maxdate as varchar(25)),CurrentFilterValue),
DateSourceTableLastRead = GetDate(),
RowsReturned= -1
WHERE SourceTableName = 'cancel'
Task 2 Syntax, with the variable user::rowsimported mapped to parameter 0
UPDATE dbo.tblLogging
SET
RowsReturned= ?
WHERE SourceTableName = 'cancel'
However I cannot make this work with a single SQL statement such as
DECLARE @maxDate datetime
SELECT @maxDate = max(dtLastChangedDate)
FROM dbo.tblCancel_RAW
UPDATE dbo.tblLogging
SET PreviousFilterValue = CurrentFilterValue,
CurrentFilterValue = ISNULL(CAST ( @maxdate as varchar(25)),CurrentFilterValue),
DateSourceTableLastRead = GetDate(),
RowsReturned= ?
WHERE SourceTableName = 'cancel'
because no matter how I try to map the parameter (0,1,2,3,4 etc) the task fails.
Is this behaviour by design, is it a bug, or is there something I've missed?
Thanks as ever,
Richard
View 1 Replies
View Related
Oct 12, 2007
Hi, this might be a simple one, but I have been stuck on it for days. I am just getting into SSIS and have been muddling through it for the rest of this package but I am stuck on this. I am using this SQL Execute Task to run some lookup queries and then call the sp_send_dbmail stored procedure. I have this placed in a For Each loop container. I am using a SELECT DISTINCT Branch FROM table1 into an Object parameter, and passing that into the loop container. I am then using a Input Parameter into this SQL Execute Task of type String. I have run a Script task right before this step to ensure that the variable is populated and correct. Any assistance would be greatly appreciated!
Here is the SQL Execute Task :
DECLARE @SQL varchar(2400), @emaillist varchar(200),
@branchMgrEmail varchar(100), @officeMgrEmail varchar(100),
@branchMgrEmpNo varchar(5), @officeMgrEmpNo varchar(5), @subjectline varchar (100),
@Today varchar(10), @BranchNumber varchar(2)
SET @BranchNumber = ?
SET @Today = convert(char(8),getdate(),1)
SET @SQL = 'SELECT rtrim(CONVERT(char(10), PostedDate, 101)) AS Posted_Date,
CAST(Branch AS CHAR(2)) AS Branch,
CAST(Department AS CHAR(2)) AS Department,
CAST(InvoiceNumber AS CHAR(7)) AS Invoice_Number
FROM onbase.dbo.MHC_IncompleteRepairOrders
WHERE Branch = ' + @BranchNumber +
'AND HardCardCount = 0
AND WorkAuthCount = 0
AND QualityControlCount = 0
AND MiscDocsCount = 0'
SET @subjectline = @Today + ' - Repair Order Validation Notification for Branch #' + @BranchNumber
SET @branchMgrEmpNo = (SELECT branchempno FROM onbase.dbo.BranchMaster WHERE Branch = @BranchNumber)
SET @officeMgrEmpNo = (SELECT officeempno FROM onbase.dbo.BranchMaster WHERE Branch = @BranchNumber)
SET @branchMgrEmail = (SELECT empemailaddress FROM onbase.dbo.ActiveDirectory WHERE CAST(empno AS integer) = @branchMgrEmpNo)
SET @officeMgrEmail = (SELECT empemailaddress FROM onbase.dbo.ActiveDirectory WHERE CAST(empno AS integer) = @officeMgrEmpNo)
SET @emaillist = @branchMgrEmail + '; ' + @officeMgrEmail
BEGIN
EXEC msdb.dbo.sp_send_dbmail
@recipients = 'email@email.com',
--@recipients = @emaillist,
--@copy_recipients = 'email@email,
@attach_query_result_as_file = 0,
@subject = @subjectline,
@body = 'This email contains a list of Stuff
',
@query = @SQL,
@query_result_header = 1,
@query_result_separator = '|',
@query_result_width = 150,
@exclude_query_output = 1,
@profile_name = 'MAIL'
END
This is a copy of the ERROR message that I am receiving. Any suggestions?
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: Send email to Branch Mgr and Office Mgr
View 11 Replies
View Related
Oct 18, 2006
Hi!
I have a execute sql task to create and drop logins. I want to create/drop the ASPNET login, but I need to pass the domain using a parameter. So I mapped a parameter:
Variable name: User::serverName
Direction: Input
DataType: Varchar
Parameter Name:0
and the sql is the following:
CREATE LOGIN [?ASPNET] FROM WINDOWS
But I get the error:
Executing the query "CREATE LOGIN [?ASPNET] FROM WINDOWS failed with the following error: "Windows NT user or group '?ASPNET' not found. Check the name again.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
What am I doing wrong?
Thank you!
View 10 Replies
View Related
Dec 18, 2007
Hi Everyone,
I'm trying to do something that should be fairly straightforward, but SSIS seems to be getting confused. I have a stored procedure which takes a timestamp as an input parameter. (NOTE: It's not a DateTime that's being stored as a DBTIMESTAMP, it really is a timestamp in the SQL sense.)
The command should be something like this:
Code Block
EXEC dbo.UpdateSynchTimestamp ?
I tried to use my variable to pass the value through Parameter Mapping, but I got an unusual error:
[Execute SQL Task] Error: Executing the query "EXEC dbo.UpdateSynchTimestamp ?" failed with the following error: "An error occurred while extracting the result into a variable of type (DBTYPE_DBTIMESTAMP)". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
This is strange for a number of reasons:
1) The DBTIMESTAMP parameter has the Direction set to "Input", so it should not be interpreted as an Output or ReturnValue.
2) The Execute SQL Task has Result Set = "None", so it should not be trying to return anything.
If I change the code to include a value hard-coded it works:
Code Block
EXEC dbo.UpdateSynchTimestamp 0x00000000000013BD
It is only when a variable is involved that it breaks.
Finally, here's the Stored Procedure itself:
Code Block
CREATE PROCEDURE [dbo].[UpdateSynchTimestamp]
@NewValue TIMESTAMP
AS
BEGIN
SET NOCOUNT ON;
UPDATE ServerSettings
SET [Value] = @NewValue
WHERE [Key] = 'SynchTimestamp'
END
Doe anyone have any suggestions as to why this isn't working for me? For the time being, I have a Script Task which constructs the command text and stores it in a variable. I can't even use an Expression because the DBTIMESTAMP is not supported.
Thanks for reading this!
View 12 Replies
View Related
Oct 8, 2007
Hello! I would like to write a value from a column to a parameter in SSIS with the Execute SQL task. The problem is that I will never get a value for the parameter.
You can recreate the problem with the AdventureWorksDW sample database.
1. Drop an execute SQL task in the control flow
2. Set the connection to the AdventureWorksDw database
3. Write this in the SQL Statement box Select Max(FullDateAlterNateKey) as LastDate
From DimTime
4. Set the resultset to single Row
5. Under result set assign LastDate as the Result Name and create a parameter with a default date.
6. Execute the task, that will finish succesfully but the value of the parameter in 5 have not changed.
I have tried to change the scope to both the package level and the task level without any success. The value of the variable is still the default value. I have also tried a string variable without sucess.
Any ideas?
Kind Regards
Thomas Ivarsson
View 5 Replies
View Related
Jul 12, 2006
Hi, I am trying to use an integer as input parameter for my task I get suck on the parameter data type.
The input parameter is define as @Control_ID variable as Int32 in SSIS. When I got into the parameter mapping of Execute SQL Task, I don't find the Int32 data type. I used to try Short, Numeric, Decimal and so on, but all of those data type didn't work. and it returns the following error message:
SSIS package "DCLoading.dtsx" starting.
Error: 0xC002F210 at Update Control_ID, Execute SQL Task: Executing the query "use DCAStaging
update DCA_HFStaging set
[dbo].[Control_ID] = P0 where [Control_ID] is null
" failed with the following error: "The multi-part identifier "dbo.Control_ID" could not be bound.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Task failed: Update Control_ID
Warning: 0x80019002 at DCLoading: 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.
SSIS package "DCLoading.dtsx" finished: Failure.
Any help?
View 6 Replies
View Related
Jun 1, 2006
I'm having a heckuva time with creating output parameters based on a query.
Here's what I'm doing. Every day, we copy rows from our mysql table to our sql server table. We only want to copy those rows that are new, so as to not have to recopy the entire table.
So I have a DataReader Source set to Ado.net/odbc provider that connects to the mysql db.
The destination is an OLE connection to the local sql server.
I create an Execute SQL Task.
The connection is set to the OLE connection
The type is direct input
The SQL Statement is "select max(id) from copy_table"
In Parameter Mapping, I create a user variable called maxId that is an int64. That variable is now used as the Variable Name. The Direction is Output. The Parameter Name is 0.
Whatever data type I use for the mapping does not work with the variable type. If the parameter was set to ULARGE_INTEGER, here's the error
[Execute SQL Task] Error: Executing the query "SELECT MAX(stats_id) AS max_id FROM copy_table" failed with the following error: "Type name is invalid.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
If parameter is set to LONG:
[Execute SQL Task] Error: An error occurred while assigning a value to variable "maxId": "The type of the value being assigned to variable "User::maxId" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object. ".
I found that if variable and parameter were dates to use datetime for the variable and DBTIMESTAMP for the parameter.
There are an awful lot of combinations between all the possible variable types, and the possible parameter types. Does anyone know the secret combination for your typical integer?
Thanks,
Lori
View 5 Replies
View Related
Feb 7, 2008
Here's the situation:
I have a ssis package which receives 3 dates as input parameters (3 datetime variables), executes different data flows and at the end inserts (among some other values) these 3 dates into a custom log table.
The problem comes while inserting the values into a log table. I added an Execute SQL Task that calls a stored procedure which inserts a record into a log table (sqlStatement exec dbo.InsertIntoLog date1=?, date2=?, date3=?).
In Parameter mapping section I set parameters = variables that hold the datetime values. The problem is that the dates are inserted into the log table in American format (mm/dd/yyyy, that's the server setting), my dates are in the european format...
Any ideas how to avoid it? Is there a way to write an expression instead of the sqlStatement in which I'd do some datepart-ing?
View 25 Replies
View Related
Dec 17, 2007
Hi ALL,
I have a Execute SQL Task to execute a stored procedure. It has no input and output parameters.
The stored procedure is defined as follows:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
CREATE PROCEDURE [dbo].[SetSLATimePriority]
AS
BEGIN
DECLARE @PriorityID tinyint,@MAXPriorityID tinyint
DECLARE @Priority NVARCHAR(MAX), @SLATime int
SET @PriorityID=1
SET @MAXPriorityID=0
SELECT @MAXPriorityID=MAX([Priority ID]) FROM [MTD Dashboard].[dbo].[Priority]
SET NOCOUNT ON;
WHILE @PriorityID<=@MAXPriorityID
BEGIN
SELECT @Priority= [Priority] FROM [MTD Dashboard].[dbo].[Priority]
WHERE [Priority ID]=@PriorityID
SELECT @SLATime= [SLA Time in hours] FROM [MTD Dashboard].[dbo].[Priority]
WHERE [Priority ID]=@PriorityID
UPDATE [MTD Dashboard].[dbo].[Remedy Dump-Filtered]
SET [SLA Time] = @SLATime WHERE [Priority] like @Priority
SET @PriorityID=@PriorityID+1
END
END
The Properties of Execute SQL Task are set as follows:
Result Set: None
Connection Type: OLEDB
SQL Source Type: Direct Input
SQL Statement: EXEC ? = [dbo].[SetSLATimePriority]
IsQueryStoredProcedure: True
ByPassPrepare: False
Parameter Mapping:
Variable Name : User::IntValue
Direction: ReturnValue
Data Type: Long
ParameterName: 0
I am getting the following error, when I run this package.
[Execute SQL Task] Error: Executing the query "EXEC ? = [dbo].[SetSLATimePriority]" failed with the following error: "Invalid parameter number". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
I am not able to figure out, where exactly the problem is.. Can some one please help me out?
View 3 Replies
View Related
Oct 18, 2007
Hi,
I have an Execute SQL Task that contains the following line:
kill ?
I have a variable (Spid) that I would like to pass as a parameter.
The connection is OLEDB.
I have tried naming the parameter 0, 1 but to no avail
I have also tried:
kill @spid
and named the parameter @Spid. This also does not work.
The variable contains a value obtained from a query that returns a spid for a locked table and is type INT32.
Can I even use the kill statement in such a context?
View 4 Replies
View Related
Jun 9, 2006
Here's the set up:
ForEach Loop Container:
Collection: Foreach File Enumerator
Variable Mappings: Variable = User::DailyFile, Index = 0
Execute SQL Taks:
Connection: OLEDB
ResultSet: None
SQLStatement: EXEC spGetFile ?
ParameterMapping: VariableName = USER::DailyFile, Direction = Input, DataType=VARCHAR, Parameter = 0
This works great it iterates through a file and looks at all the files checks to see if they have been loaded into the db table, if not it loads the file.
My spGetFile has RETURN 1 if a file is loaded and RETURN 0 if the file is not loaded.
Now I add a new variable:
Step 1: add to Foreach Loop Container
ForEach Loop Container Name = Return, Scope = ForEachLoop, Data Type= Int32 Value=0
Step 2: Add to Execute SQL Task:
VariableName = User:Return, Direction = ReturnValue, DataType = Long, ParameterName =1
This produces the following error:
~~"Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.~~
I tried with an ADO.Net connection ... works until I add the ReturnValue parameter ...
Any ideas??
Thanks
View 4 Replies
View Related
Mar 29, 2007
I've encountered a new problem with an SSIS Pkg where I have a seq. of Execute SQL tasks. My question are:
1) In the First Execute SQL Task, I want to store a single row result of @@identity type into a User Variable User::LoadID of What type. ( I tried using DBNull Type or Object type which works, not with any other type, it but I can't proceed to step 2 )
2) Now I want to use this User::LoadID as input parameter of What type for the next task (I tried using Numeric, Long, DB_Numeric, Decimal, Double none of there work).
Please give me solutions for the above two..
View 6 Replies
View Related
Mar 11, 2004
Can the DTS execute SQL task recognize a table in an Access database that is linked from another Access database?
I'm attempting to use a DTS Execute SQL task connected to Access1.mdb to make a new table in Access1.mdb that is using a Subquery from a linked table in Access2.mdb . (I know it sounds convoluded..) Its giving me an error in my FROM clause as if it can't recognize the linked table from Access2.mdb.
The reason why I'm doing this is that I'm not sure how to run an Access make table query from DTS that will overwrite the existing table in Access. I get an error that the table already exists.
Any Help?
View 1 Replies
View Related
Jun 21, 2007
OK. I give up and need help. Hopefully it's something minor ...
I have a dataflow which returns email addresses to a recordset.
I pass this recordset into a ForEachLoop configuring the enumerator as (Foreach ADO Enumerator). I also map the email address as a variable with index 0.
I then have a Execute SQL task which receives this email address as a varchar variable (parameter 0) which I then use in my SQL command to limit the rows returned. I have commented out the where clause and returned all rows regardless of email address to try to troubleshoot this problem. In either event, I then use a resultset to store the query result of type object and result name 0.
I then pass this resultset into a script variable to start parsing the sql rows returned as type object. ( I assume this is the correct way to do this from other prior posts ...).
The script appears to throw an exception at the following line. I assume it's because I'm either not passing in the values properly or the query doesn't return anything. However, I am certain the query works as it executes just fine at the command prompt.
Try
ds = CType(Dts.Variables("VP_EMAIL_RESULTS_RS").Value, DataSet)
My intent is to email the query results to each email address with the following type of data by passing the parsed data from the script to a send mail task. Email works fine and sends out messages but the content is empty. I pass the parsed data as string values to the messagesource and define the messagesourcetype as a variable in the mail task.
part number leadtime
x 5
y 9
....
Does anyone have any idea what I might be doing wrong?
thanks
John
View 5 Replies
View Related
Feb 22, 2008
Hi
I have a situation below
Table : tblStatus
Column1 : Event_Desc
Column2 : Flag
Once the flag is set to "T", I want to trigger a SSIS package named "PerformAction.dtsx"
How to write a table trigger for this.
With Regards,
Madhu
View 7 Replies
View Related
Oct 8, 2007
I had created an Script Task to put data into the few variables then I created an SQL Execute Task to use the SQL query to collect data from a database. Now I want to put that data into a different database.
I noticed it can not be done because the SQL Execute Task is one object and the other object is Data Flow Task. (The Destination database is inside that object).
So, if it is possible then how? If not then what should be done instead?
Thanks...
View 1 Replies
View Related
Jun 19, 2015
How to capture execute sql task results.
Example if the execute sql task runs select statment (select * from table)means , how do i capture into sql table.
View 10 Replies
View Related
Jun 20, 2015
Have an SSIS package running great in 2008R2. It generates several flat files based on inline database queries. The first step of the package inserts a record into a log stats table and the last step of the package updates this record with the package name, run time and execution status. Now I need to add the records counts for each flat file to the log table.
Is there a way I can update one field for run counts with each of the counts for each file. So the [run counts] table column would look something like:
file1: 43522
file2: 645367
file3: 7883
Is it possible to store the record counts and flat file names in variables then concat them at the end when updating this record?
Or, is a better way to just insert/update a new record for each flat file step and log the counts for that file for its own record?
In either case, how I can capture the file count and pass that to the update statement.
View 4 Replies
View Related
May 8, 2007
Hi friends,
I couldn't find links for this issue.
1) How to write the contents of a dataset or a full resultset (from execute sql task) directly into a Sql Server 2005 table.
2) Since I have hundreds of Resulting columns, I want to create the Destination table based on the structure of the dataset.
How can we achieve this?
Thanks
Subhash Subramanyam
View 4 Replies
View Related
May 18, 2008
SSIS Newbie Question:
I have a simple Control Flow setup that checks to see if a particular table exists. If the table does not exists, the table is created in an alternate path, if it does exist, the table is truncated before moving to a file import Data Flow that uses an OLE DB Destination to output the imported data.
My problem is, that I get OLE DB package errors if the table the OLE DB Destination Container references does not exist when I load the package.
How can I over come this issue? I need to be able to dynamically create the table in an earlier step, then use that table to import data into in a later step in the workflow.
Is there a switch I can use to turn off checking in the OLE DB Destination Container so that it will allow me to hook up the table creation step?
Seems like this would be a common task...
Steps:
1. Execute SQL Task to see if the required table exists
2. Use expresions to test a variable to check the results of step 1
3. If table exists, truncate the table and reload it from file in Data Flow using OLE DB Destination
4. If table does not exist, 1st create it, then follow the normal Data Flow
Can someone help me with this?
Signed: Clueless with a deadline approaching...
View 3 Replies
View Related
Dec 6, 2006
Dear all:
I had got the below error when I execute a DELETE SQL query in SSIS Execute SQL Task :
Error: 0xC002F210 at DelAFKO, Execute SQL Task: Executing the query "DELETE FROM [CQMS_SAP].[dbo].[AFKO]" failed with the following error: "The transaction log for database 'CQMS_SAP' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
But my disk has large as more than 6 GB space, and I query the log_reuse_wait_desc column in sys.databases which return value as "NOTHING".
So this confused me, any one has any experience on this?
Many thanks,
Tomorrow
View 5 Replies
View Related