Execute SQL Task (SSIS 2005) SP2 And Resultset To A Parameter
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
ADVERTISEMENT
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
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
Dec 28, 2006
hi all,
in my execute sql task, i have a try catch statement to catch error code if there's an error...
begin try
insert into person.contact (contactid)
values ('1')
end try
begin catch
select @@error as ErrorCode
end catch
this ErrorCode will be mapped to a user variable.
my problem is the value for ResultSet.
in order to assign ErrorCode to the variable, i have to set the ResultSet value to Single row, but if this task does not fail, i need to set ResultSet value to None in order for it to run successfully.
How do i go about solving this problem?
Please help. thanks!
View 16 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
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
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
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 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
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
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
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
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
Jun 26, 2007
Is it possible to CREATE a database using SSIS and name it using a variable / parameter mapping.
if not, how can I use SSIS to take a username from a database table and create a database with that name?
thanks is advance....b
View 10 Replies
View Related
Sep 12, 2007
A stored function is created in MySQL Server running on Linux with following info:
mysql > delimiter $$
mysql > CREATE FUNCTION GetMaxKeyForSampleTable()
-> RETURNS DOUBLE READS SQL DATA
-> BEGIN
-> RETURN (SELECT MAX(MJD) FROM tblSampleTable);
-> END;
Query OK, 0 rows affected (0.02 sec)
mysql > delimiter ;
***The above function is successfully stored in the database.
"Execute SQL Task" add-in module has following info:
Name: Execute SQL Task
Description: Execute Task
TimeOut: 0
CodePage: 1252
ResultSet: Single row
Connection Type: ADO.NET
Connection: .MySQLServerLinux
SQLSourceType: Direct Input
SQL Statement: SELECT GetMaxKeyForSampleTable() AS MaxKey
IsQueryStoredProcedure: True
ByPassPrepare: False
Result Set:
Result Name Variable Name
MaxKey User:_dMaxKey
The following steps are taken:
1. Clicked "Parse Query" push button which results a pop-up dialog box -
"The query parsed correctly".
2. Clicked "OK" button.
3. Right clicked "Execute SQL Task" add-in module.
4. Selected "Execute Task".
"Execute SQL Task" changed its color from white to yellow to red
which means excution failed.
Please help me to figure out what should be done to make the excution successful.
Thank you very much in advance.
Paul Cho
View 4 Replies
View Related
Jul 23, 2007
Hi
Got a problem with 'Execute SQL Task'. When I click to open the 'Execute SQL Task Editor', add a connection then click on 'Parameter Mapping' then click 'Add' button the window disappears. I have re-installed visual studio and applied SP1 but the problem is still there.
Any Ideas?
Nickie
View 1 Replies
View Related
May 8, 2006
Hi!
I want to make an Execute Process Task that will make a connection with VCP.exe (Secure FTP from SecureCRT, you need to install all components from SecureCRT to have this one. It also fixes your system paths so you dont need to include the working directory).
In Expression Window i managed to create an expression that will create the connection string that looks like this:
"vcp.exe -pw password username@222.222.222.222:/home/username/tickets/" + "grnti_" + RIGHT("0" + (DT_STR, 4, 1252) YEAR( GETDATE() ), 4) + RIGHT("0" + (DT_STR, 2, 1252) MONTH( GETDATE() ), 2) + RIGHT("0" + (DT_STR, 2, 1252) DAY( GETDATE() ), 2) + "0000" + " c:\DATA\" + "grnti_" + RIGHT("0" + (DT_STR, 4, 1252) YEAR( GETDATE() ), 4) + RIGHT("0" + (DT_STR, 2, 1252) MONTH( GETDATE() ), 2) + RIGHT("0" + (DT_STR, 2, 1252) DAY( GETDATE() ), 2) + "0000"
Which forms something like that :
vcp.exe -pw password username@222.222.222.222:/home/username/tickets/grnti_200605080000 c:DATAgrnti_200605080000
Connection string works perfectly while testing in cmd.exe or directly running with Run..., but within SQL SSIS i get the message :
SSIS package "Package.dtsx" starting.
Error: 0xC0029153 at VCP to Srv, Execute Process Task: File/Process "grnti_200605080000" does not exist in directory "vcp.exe -pw password username@222.222.222.222:homeusername icketsgrnti_200605080000 c:DATA".
Error: 0xC0024107 at VCP to Srv: There were errors during task validation.
SSIS package "Package.dtsx" finished: Success.
Now this message seems a bit odd, because im only trying to run an application with all the arguments with it.
Anyone experienced anything similar, or should i use another approach on this one?
Thanks!
Sebastijan L.
Ok ! Problem solved, will keep the thread as it might be usefull to someone else.
I changed the expression from Executable to Argument cut the "vcp.exe" out and it works like a charm!
View 1 Replies
View Related
Aug 20, 2007
My configuration database is made to work with both SQL Server 2005 and 2000, could this be an error that has to do with that?
Here is the query that I am using...
DECLARE @Server [nchar] (100)
SET @Server = (CONVERT(char(100), (SELECT SERVERPROPERTY('Servername'))))
INSERT INTO [tempdb].[dbo].[Server_Roles] (Server, ServerRole, UserName)
SELECT
@Server,
role.name,
member.name
FROM
sys.server_role_members rm
inner join
sys.server_principals member
ON
rm.member_principal_id = member.principal_id
inner join
sys.server_principals role
ON
rm.role_principal_id = role.principal_id
********Begin Errors***************
" failed with the following error: "Invalid object name 'sys.server_principals'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Task failed: Execute SQL Task I
Error: 0x0 at Execute SQL Task I: Invalid object name 'sys.server_role_members'.
Error: 0x0 at Execute SQL Task I: Invalid object name 'sys.server_principals'.
View 4 Replies
View Related
Feb 19, 2008
I am trying to create an SSIS package to transfer data from one database to another. Prior to transfering the data I want to delete the existing data in the target table. When I try to configure the task I get this message:
The task with the name "Execute SQL Task" and the creation name "Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ExecuteSQLTask, Microsoft.SqlServer.SQLTask, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" is not registered for use on this computer.
Contact Information:
Execute SQL Task
Prior to installing .NET 3.0 I did not have this problem. Any thoughts on how to resolve this problem? My thought is there was an installation registration issue.
Thanks in advance for your help.
scsmith
View 4 Replies
View Related