Store Varbinary Data Result Into SSIS Variable Through Execute SQL Task

Feb 13, 2008

I cannot find the data type for parameter mapping from Execute SQL Task Editor to make this works.

1. Execute SQL Task 1 - select max(columnA) from tableA. ColumnA is varbinary(8); set result to variable which data type is Object.

2. Execute SQL Task 2 - update tableB set columnB = ?
What data type should I use to map the parameter? I tried different data types, none working except GUI but it returned wrong result.

Does SSIS variable support varbinary data type? I know there's a bug issue with bigint data type and there's a work-around. Is it same situation with varbinary?

Thanks,

-Ash

View 8 Replies


ADVERTISEMENT

In SSIS Execute SQL Task, Single-row Result From Querying Mysql Binding With A Variable

Jul 20, 2007

I set up a connection to mysql using ADO.NET's ODBC Data Provider. And I'm running a simple query to return one table's maximum ID(int32 unsigned). There is no problem to achieve that.



But when I bind the result to a variable and excute task. It gives out error message: "An error occurred while assigning a value to variable "MaxAuditLogID": "Result binding by name "MaxID" is not supported for this connection type. "



I tried to change the type of variable around but with no luck.



Could anyone help with this issue? Thanks!

View 6 Replies View Related

Store SQL Task Result As Variable

Mar 18, 2008



Help - I am having a moment!

I am building a simple package that looks at the results of a sql query, prior to running the next step.

Basically Outline and settings


SQL task


Result Set: Full result set

SQL Source: Direct Input

SQL Statement: Select Count (*) FROM X

Parameter Mapping


Variable Name: User::C

Direction: Return Value

Data Type: Numeric

Parameter Name: NewParameterName

Result Set = NewResultName: User::C

Precedence Constraint


Evaluation Operation: Expression and Constraint

Value: Success

Expression: @C > 0 ( I originally tried User::C and received an error message)

Execute SQL Server Agent Job


If step one results greater than 1, then execute the SQL agent job (SRS Report)
Using this setup I receive an error message stating "

TITLE: Package Validation Error
------------------------------
Package Validation Error
------------------------------
ADDITIONAL INFORMATION:
Error at Package: The expression "@C > 0" must evaluate to True or False. Change the expression to evaluate to a Boolean value.
Error at Package: There was an error in the precedence constraint between "Execute SQL Task" and "Execute SQL Server Agent Job Task".
(Microsoft.DataTransformationServices.VsIntegration)


Any thought or suggestions would be greatly appreciated.

r/ Anthony

View 7 Replies View Related

Can I Retrieve A Result Set From A Sp Into A Variable Within A Execute SQL Task?

Jan 25, 2007

Can I retrieve a result set from a sp into a variable within a Execute SQL Task?

View 23 Replies View Related

Execute SQL Task - Assign The Result To A Variable

Jun 13, 2007

Hi,



Let's say that the query in my SQL Task returns a single integer number.



How can I put that single number in a variable?



Thank you.

View 3 Replies View Related

Trying To Set Output Variable To Row Count Result Of SQL Execute Task

Nov 5, 2007

I am building this as an expression, but it is not working. I am trying to return the row count into a variable to use later in an update statement. What am I doing wrong? I am using a single row result set. I have one variable defined in my result set. I am receiving an error stating: Execute SQL Task: There is an invalid number of result bindings returned for the ResultSetType: "ResultSetType_SingleRow". Any help is appreciated!

SELECT count(*) FROM hsi.itemdata a
JOIN hsi.keyitem105 b on a.itemnum = b.itemnum
JOIN hsi.keyitem106 c on a.itemnum = c.itemnum
JOIN hsi.keyitem108 d on a.itemnum = d.itemnum
WHERE a.itemtypegroupnum = 102
AND a.itemtypenum = 108
AND b.keyvaluechar = " + (DT_WSTR,2)@[User::Branch] + "
AND c.keyvaluechar = " + (DT_WSTR,2)@[User:epartment] + "
AND d.keyvaluesmall = " + (DT_WSTR,7)@[User::InvoiceNumber] + ")

View 6 Replies View Related

Xml Result Set To A Variable In Ssis And To Access It In Script Task

Apr 28, 2007

Hi!

I have an sproc that gives an xml result set. I want to save this to a file but by using ssis and script task. Now, I do exec usp_myProc in execute sql task and get the result as xml. (I can get it as result set too but niether has worked). Now I pass this variable to my script task User::XRset.

In the script task I create a file and then I want to write xml result of User::XRset to my file. I am at loss.

View 4 Replies View Related

Using Variable In Execute SQL Task In SSIS

Mar 12, 2008



Hi

I need to use a variable as column in SQL statement in Execute SQL task of integration services. I am setting Parameter Setting to map variable use it in the query like; select ? , col1name from tablename. But its not working.
Anybody having any idea; would be of great help.

Thanks,
Salman Shehbaz.

View 3 Replies View Related

Execute SQL Task With Full Result Set Stores Data As What?

Oct 22, 2007

Howdy all,

I have an Execute SQL Task that may return a result set. If it returns a result set, I'd like to log a failure in my package with the results visible.

I have logging turned on and that's working great. I've read about assigning results to a user variable of type Object and that's great. I can shred my results, thanks Jamie, with a Foreach loop no problem. Within that loop, I've got some VB that manipulates the values and will call Dts.Events.FireError as appropriate. However, VB is frowned upon here so my boss has asked that I push the VB logic into a Control Flow item.

I've built custom components already so I've got some familiarity with the process. Where I'm stuck at is figuring out _what_ the actual object type is in my code. The Connection manager is Native OLE DBSQL Native client. My Execute SQL Task uses a connection type of OLE DB with a Full result set. Results are stored in a variable named ErrorResultSet. Within the Execute method, I currently have this code set up in an attempt to pick apart the object and discover the available methods.





Code Block
Variables _variableCollection = null;
if (variableDispenser.Contains("ErrorResultSet"))
{
variableDispenser.LockForRead("ErrorResultSet");
}
variableDispenser.GetVariables(ref _variableCollection);

// Iterate through the variables that we were
// able to lock. Assigning values to entities as
// available.
foreach (Variable _en in _variableCollection)
{
switch (_en.Name)
{
case "ErrorResultSet":
Object _rs = _en.Value;
System.Type _type;
_type = _rs.GetType();
System.Data.DataSet _realResults;
_realResults = _rs as System.Data.DataSet;
// My expectation is that the cast of _realResults would
// not fail.
break;
}
}
// unlock before we go
_variableCollection.Unlock();
return DTSExecResult.Success;







At this point, my assumption is that the unboxed type of the recordset is not in the System.Data.DataSet inheritance chain as the cast failed. Anyone have insight into what it is? I can't seem to get any hits on google for what it's using behind the scenes in the Foreach ADO Enumerator.


Beyond the immediate question, anyone have thoughts on how else I can solve the problem? I had thought perhaps the task could raise an event if it returned rows but it didn't seem to have that functionality. Even if that had worked, telling the logging provider to capture the result set into the log might have been too much for native functionality. Another option I was thinking about would be to continue using the Enumerator and my custom component is a pure rewrite of the current Script task with the obvious downside being that I'd lose the generic-ness I was hoping to get with being able to hit my dataset.

View 8 Replies View Related

Using A Variable In An Expression To Populate The Executable Property Of An Execute Process Task In SSIS

Jan 22, 2008

Hello,

I am having a hard time setting the executable path for an Execute Process Task in SSIS. I have a variable that is initialized at package statup which holds the path to an executable in Windows. When I set the property "Executable" Path in an expression, I get a warning that the path for the executable is not set. One workaround was to try and initialize the variable with a bogus path with the hopes that the "correct" value will be written on run-time. NO LUCK. I still get the error and I cannot run the package until I put a static path.

Does anyone have a clue as to what is going on??

Mike

View 1 Replies View Related

Problem Assigning SQL Task Result To A Variable - Select Count(*) Result From Oracle Connection

Dec 26, 2007



I have an Execute SQL Task that executes "select count(*) as Row_Count from xyztable" from an Oracle Server. I'm trying to assign the result to a variable. However when I try to execute I get an error:
[Execute SQL Task] Error: An error occurred while assigning a value to variable "RowCount": "Unsupported data type on result set binding Row_Count.".

Which data type should I use for the variable, RowCount? I've tried Int16, Int32, Int64.

Thanks!

View 5 Replies View Related

Writing Full Result Set From Execute SQL Task Into A File Using Script Task

Mar 28, 2007

In the Control flow tab, I have an Execute SQL Task that outputs full Result set into a variable of an object type. Now how can I write the contents of the Full Result Set into a text file using Script Task. I also want to format the following way while I output into a file:

Column Name 1 : Column Value

Column Name 2: Column Value and so on

I tried writing the contents of the Object Variable into a file, but the file had an output of single word: System.__ComObject.




Code for Writing the Full Result Set into a Text File

Dim RSsqloutput as String = Dts.Variables("objVariable").Value.ToString

Dim strVal as String = "File completed on " & Now() & vbCrLf & "------------------------------------------------------" & vbCrLf

oLogFile.WriteAllText("C:MyFile.txt", strValue)

oLogFile.WriteAllText("C:MyFile.txt", rsSQLOutput)



I went through this link that explains how to write XML Result Set into a File, But this doesn't help as it writes in XML format.

Would you please give me a hint of code how I can go upon.





View 7 Replies View Related

Looking For A Way To Refer To A Package Variable Within Any Transact-SQL Code Included In Execute SQL Or Execute T-SQL Task

Apr 19, 2007

I'm looking for a way to refer to a package variable within any
Transact-SQL code included in either an Execute SQL or Execute T-SQL
task. If this can be done, I need to know the technique to use -
whether it's something similar to a parameter placeholder question
mark or something else.


FYI - I've been able to successfully execute Transact-SQL statements
within the Execute SQL task, so I don't think the Execute T-SQL task
is even necessary for this purpose.

View 5 Replies View Related

Store Count Result In A Local Variable

Feb 10, 2000

Hi All,
I need to store the row count from two different servers (one 6.5 and one 7.0)
to compare by doing this:(in T-SQL)

declare @kount1 int, @kount2 int
exec master..xp_cmdshell 'isql -Sserver65 -d dbA -T -Q "select count(*) from tableA",no_output
exec master..xp_cmdshell 'isql -Sserver70 -d dbA -T -Q "select count(*) from tableA",no_output

How can I save the rowcount in @kount1, @kount2 respectively for comparison?
Appreciate your feedback.
David Nguyen

View 4 Replies View Related

Store Result Of Stored Procedure Into A Variable

Oct 16, 2007

I wrote a stored procedure that finds a number. I want to store the number it finds into a variable so i can use it within another procedure.
I hope i'm being clear.
Any help will be appreciated.
Here is an example of how i am finding my number
Employee is the name of my table and Number is the name of my column.

SELECT Max(Number)
FROM Employee

View 5 Replies View Related

Using Varbinary(max) And UPDATE .WRITE To Store Data In A Streaming Fashion

Nov 1, 2007

I have the following table:

CREATE TABLE [dbo].[IntegrationMessages]
(
[MessageId] [int] IDENTITY(1,1) NOT NULL,
[MessagePayload] [varbinary](max) NOT NULL,
)


I call the following insertmessage stored proc from a c# class that reads a file.

ALTER PROCEDURE [dbo].[InsertMessage]
@MessageId int OUTPUT
AS
BEGIN


INSERT INTO [dbo].[IntegrationMessages]
( MessagePayload )
VALUES
( 0x0 )

SELECT @MessageId = @@IDENTITY

END


The c# class then opens a filestream, reads bytes into a byte [] and calls UpdateMessage stored proc in a while loop to chunk the data into the MessagePayload column.


ALTER PROCEDURE [dbo].[UpdateMessage]
@MessageId int
,@MessagePayload varbinary(max)

AS
BEGIN


UPDATE [dbo].[IntegrationMessages]
SET
MessagePayload.WRITE(@MessagePayload, NULL, 0)
WHERE
MessageId = @MessageId


END



My problem is that I am always ending up with a 0x0 value prepended in my data. So far I have not found a way to avoid this issue. I have tried making the MessagePayload column NULLABLE but .WRITE does not work with columns that are NULLABLE.

My column contains the following:
0x0043555354317C...
but it should really contain
0x43555354317C...


My goal is to be able to store an exact copy of the data I read from the file.

Here is my c# code:

public void TestMethod1()
{
int bufferSize = 64;
byte[] inBuffer = new byte[bufferSize];
int bytesRead = 0;

byte[] outBuffer;

DBMessageLogger logger = new DBMessageLogger();

FileStream streamCopy =
new FileStream(@"C:vsProjectsSandboxBTSMessageLoggerInSACustomer3Rows.txt", FileMode.Open);

try
{
while ((bytesRead = streamCopy.Read(inBuffer, 0, bufferSize)) != 0)
{
outBuffer = new byte[bytesRead];

Array.Copy(inBuffer, outBuffer, bytesRead);

string inText = Encoding.UTF8.GetString(outBuffer);

Debug.WriteLine(inText);





//This calls the UpdateMessage stored proc
logger.LogMessageContentToDb(outBuffer);
}
}
catch (Exception ex)
{
// Do not fail the pipeline if we cannot archive
// Just log the failure to the event log
}
}

View 7 Replies View Related

Is It Possible To Store The Result Of A Dynamic Query In A Local Variable

Dec 19, 2000

I have a dynamic query which returns me a result and I want to capture that value to make further use of it in the same code. Is that possible??
exec ('select col_nm from table_name'). i want the result of this query to be captured.
DP

View 4 Replies View Related

How To Write A SELECT Statement And Store The Result In A Session Variable

Nov 6, 2007

I'm sure this is a very simple piece of code, but I'm having trouble understanding how to do this.
First I have a database with three columns


ContactID

View 1 Replies View Related

How To Store Multiple Result In A Variable On Sql Server Stored Procedure

Feb 29, 2008

 name               age            weightaaa                    23                50bbb                    23                60ccc                     22               70ddd                    24                20  eee                     22               30i need the output that calculate the sum of weight group by name input : age limit ex: 22 - 23 output  : age           total weight  23               11022                100  this output must stored in a sql declared variable for some other further process . 

View 7 Replies View Related

T-SQL (SS2K8) :: Store Result Of Stored Procedure Into XML / Nvarchar (max) Variable

Feb 16, 2012

I have a stored procedure that returns XML using FOR XML Explicit. I need to use the output of this procedure in another procedure, and modify the xml output before it is saved somewhere.

Say StoredProc1 is the one returning xml output and StoredProc2 needs to consume the output of StoredProc1

I declared a nvarchar(max) variable and trying to saved the result of StoredProc1

Declare @xml nvarchar(max)
EXEC @xml = StoredProc1 @Id

This doesn't work as expected as @xml doesn't get any value assigned or rather I would say

EXEC @xml = StoredProc1 @Id

outputs the entire xml whereas it should just save the xml in a variable.

View 7 Replies View Related

Result From Execute Process Task

Mar 5, 2008

On an Execute Process Task, are there properties I can examine to determine the outcome of a process? I know that I can use a Success/Failure constraint to direct my workflow appropriately, depending on the outcome, but I would prefer the workflow continue on to the same task regardless, and then be able to change the flow later on based on the outcome of the process.

I see there is an ExecValueVariable property, and this may be what I'm looking for, but I have no idea what this is and can not find any documentation on it. I tried using it, but kept getting a runtime error trying to set it to a variable.

I know that a process returns a numeric value, and it would be nice if I could store this somewhere.

Any suggestions?

Thanks in advance.
Jerad

View 3 Replies View Related

Result From Sql Task In Variable

Feb 21, 2008

i need to know how many rows are in a certain table and store this value in a variable in order to process this variable later in the package. of course i can build a data flow task within a row count component but as far as i understand it's necessary to read all data from a data source in order to use the row count component. now the question is if it's possible to use a sql task in the control flow and put a select count(*) statement within the task and then write the result of this select statement into a variable. shouldn't that be much more faster than using a whole dataflow for this problem?

View 1 Replies View Related

Execute SQL Task Error: No Result Rowset Associated...

Feb 19, 2007

I am getting the following error when I execute my sql task:

An error occurred while assigning a value to variable "NullVar": " NO result rowset is associated with the execution of this query. "

I am executing a SP that has one input & one output parameter. The output parameter is returning a single row for debugging if the sp failes.
I tried using Jamie's method:(http://blogs.conchango.com/jamiethomson/archive/2005/12/09/2480.aspx) to get it to work but keep getting the above error. I have the following variables:

sqlSource (string) := Exec RBCprcsInsertWmsInvTransactionRecords '" + (DT_WSTR,10 ) @[User::SnapShotDate] + "', NULL"
NullVar (string)

In the execute sql task, I set the ResultSet to single row. I set SQLSourceType = variable & sourcevariable = user::SqlSource. In the result tab, I added a result set, NewResultName with the variable user::NullVar. I tried different configurations with the parameter mappings but nothing seemed to work. I didn't know if i still had to use this if I am using the sqlSource variable to drive the task.

So I am not sure what I am missing here. Anyone have any suggestions?

Thanks!
John

View 5 Replies View Related

Store Procedure Fails In Execute SQL Task

Mar 19, 2008

I have a Execute SQL Task that calls a stored procedure. 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. It has a date parameter, but hard coding the date parameter does not work either. I checked the permissions on the Stored Procedure and SQL Agent, which are ok. When I change BypassPrepare to True, the query will execute and insert the rows to the required table. If someone has an explanation for this, I would appreciate some sql enlightenment. Thanks.

Dan

View 6 Replies View Related

SQL Task, Result To Variable Errors Out

Jan 31, 2008

I have looked thru several similar threads with errors like this, but have not found a resolution. I have a SQL Task that runs this query:




Code Snippet
select NetRevenue = cast(sum(Base_Price + AL + MI + PO) as dec(10,2))
from Lancelot.DataWhse.dbo.GrossMarginDetail
where tran_date_key <= ? + ' 23:59:59' and
label_group <> 'X' and
not (ar_ship_key in ('S999991','S998101''S998102')) and
Document <> 'Cust Bal Debit Memo'






There is a parameter mapping of "User::LastSaturday" of type date. I also have a result set with a result set name of "0" with a variable name of "User::GrossMargin," which is defined as a double in the package. The task has a resultset type of Single row, and at the moment the answer that is returned is 66228637.10.

If I change the package variable to a type of string it of course works, but then I cannot do comparisons against it. I have step by step manually copied this from an existing DTSX, so I am baffled why this isn't working, and I'm ready to throw myself under a truck!

I also tried to bring it in as a string, then convert it in a script task, but I cannot figure out how to reference the input and output variables. I can't seem to find any relevant docs on how to do that...

If anyone has any ideas, I and my sanity would greatly appreciate it.

View 5 Replies View Related

Execute Process Task Depending On Query Result

Apr 2, 2007

Hi Guys,



I wonder if you can help with the following requirement.



I want to be able to conditionally execute an 'execute process task' depending on the result of a query. I have a table which I will select one record/row from upon each execution, this record has a char 1 'type' field which is the indicator for what process to then execute.



This should be quite a simple package and will be run every 60 seconds so needs to be as efficient as possible.



I am thinking I should go along the lines of using an Execute SQL task to select my row in to a result set, and using a series of precedence expressions to determine what process to execute. But im not really sure how.....



I am a newbie to SSIS and 2005 in general so would appreciate any help you can provide



Chris

View 3 Replies View Related

Execute SQL Task With XML Result Set With SSAS Database Script

Nov 20, 2007

Hi everybody,

For our customer we are trying to create dynamically local cube files. Because the requirements are complex and we need to generate a lot of cube files, we can't use the MDX script CREATE GLOBA CUBE to create the local cubes and we have to use SSIS to have it done automatically. These are the steps we are following:
1. In a SSIS package, through a Script task, we generate the ASSL script in order to create the database and we stores the script in a column of the XML datatype in SQL Server through a stored procedure "SSAS_TEST.InsertASSLScript". The following code is use in the script task:




Code Block
Imports System
Imports System.IO
Imports System.Data
Imports System.Math
Imports System.Xml
Imports System.Data.SqlClient
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.AnalysisServices
Class ScriptMain
'Create writers and set formating for xml
Dim myScripter As Scripter
'Represents a writer to write information to a string
Dim myStringWriter As New System.IO.StringWriter()
Dim myStringWriterTrans As New System.IO.StringWriter()
'Represents a writer that provides a fast, non-cached, forward-only way of generating streams or files containing XML data that conforms to the W3C Extensible Markup Language (XML) 1.0 and the Namespaces in XML recommendations.
Dim myXmlTextWriter As System.Xml.XmlTextWriter
Dim myXmlTextWriterTrans As System.Xml.XmlTextWriter
Dim myXmlWriterSettings As XmlWriterSettings
Sub New()
myScripter = New Scripter
myXmlTextWriter = New System.Xml.XmlTextWriter(myStringWriter)
myXmlTextWriterTrans = New System.Xml.XmlTextWriter(myStringWriterTrans)
myXmlWriterSettings = New XmlWriterSettings
myXmlWriterSettings.OmitXmlDeclaration = True
myXmlWriterSettings.ConformanceLevel = ConformanceLevel.Auto
myXmlTextWriter.Formatting = Formatting.Indented
myXmlTextWriter.Indentation = 2
End Sub
Public Sub Main()
'Get Server name from DTS connection object and store in variable
Dim oDTSASConnection As ConnectionManager = Dts.Connections("SARP_Cubes")
Dim sASServer As String = CStr(oDTSASConnection.Properties("ServerName").GetValue(oDTSASConnection))
'MsgBox("Server " & sASServer & " has been connected")
Dim oASServer As New Microsoft.AnalysisServices.Server
'Connect to the requested server
oASServer.Connect(sASServer)
'Get Database name from DTS connection object and store in variable
Dim sASDBName As String = CStr(oDTSASConnection.Properties("InitialCatalog").GetValue(oDTSASConnection))
Dim oASDatabase As New Microsoft.AnalysisServices.Database
'MsgBox("InitialCatalog " & sASDBName & " has been found")
'Get database sASDBName and store in variable
oASDatabase = oASServer.Databases.GetByName(sASDBName)
'MsgBox("Database " & sASDBName & " has been connected")
'Get Cube
Dim CubName As String
If Dts.Variables.Contains("CubName") = True Then
CubName = CType(Dts.Variables("CubName").Value, String)
End If
Dim oASCube As New Microsoft.AnalysisServices.Cube
'MsgBox("Database " & sASDBName & " has been connected")
'Create a variable to store the create cube ASSL-script
'Dim sASSLCreateCub As String
'Store the create script in myXmlTextWriter
myScripter.ScriptCreate(New MajorObject() {oASDatabase}, myXmlTextWriter, False)
myXmlTextWriter.Flush()

'Create a string in order to manipulate the XML-string and append the Batch and process element
Dim sASSLString As String
sASSLString = "" & myStringWriter.ToString & "ProcessFull SARP_Cubes"

'Make a database conenction through connection manager
'Get Server name from DTS connection object and store in variable
Dim oDTSDBConnection As ConnectionManager = Dts.Connections("METADATA")
Dim sDBServer As String = CStr(oDTSDBConnection.Properties("ServerName").GetValue(oDTSDBConnection))
Dim sDBDatabase As String = CStr(oDTSDBConnection.Properties("InitialCatalog").GetValue(oDTSDBConnection))
Dim oBuilder As New SqlConnectionStringBuilder()
oBuilder.DataSource = sDBServer
oBuilder.InitialCatalog = sDBDatabase
oBuilder.ConnectTimeout = 1000
oBuilder.IntegratedSecurity = True
oBuilder.ApplicationName = "InsertASSLScript"
Dim oDBConnection As New SqlConnection(oBuilder.ConnectionString.ToString)
' Create Sql Command
Dim cmd As New SqlCommand("SSAS_TEST.InsertASSLScript", oDBConnection)
cmd.CommandTimeout = 60
cmd.Connection = oDBConnection
cmd.CommandType = CommandType.StoredProcedure
' Add parameters and their values
cmd.Parameters.Add(New SqlParameter("@COUNTRY_CODE", SqlDbType.VarChar, 255)).Value = "999"
cmd.Parameters.Add(New SqlParameter("@CUBE_XMLA", SqlDbType.VarChar)).Value = sASSLString
cmd.Parameters.Add(New SqlParameter("@DATABASE_ID", SqlDbType.VarChar, 255)).Value = sASDBName
cmd.Parameters.Add(New SqlParameter("@CUBE_ID", SqlDbType.VarChar, 255)).Value = "ALL CUBES"
' Open the connection
oDBConnection.Open()
' Execute the command
cmd.ExecuteNonQuery()
' Clean Up
myStringWriter.Close()
myStringWriterTrans.Close()
'myStringReader.Close()
'myXMLReader.Close()
myXmlTextWriter.Close()
'oDBConnection.Close()
oASServer.Disconnect()
Dts.TaskResult = Dts.Results.Success
End Sub

End Class





2. We manipulate the ASSL-script in order to create the cube that we want to have as local cube

3. We extract the final ASSL-script from the database through an "Execute SQL Task" with a XML Result Set. The SQL use in the task is:




Code Block
SELECT cast(CUBE_XMLA as varchar(max))
FROM SSAS_TEST.CUBE_XMLA
WHERE (COUNTRY_CODE = '500')




I have also tried




Code Block
SELECT CUBE_XMLA
FROM SSAS_TEST.CUBE_XMLA
WHERE (COUNTRY_CODE = '500')




and




Code Block
SELECT CUBE_XMLA
FROM SSAS_TEST.CUBE_XMLA
WHERE (COUNTRY_CODE = '500')
FOR XML AUTO




I always get the same error:
"Execute SQL Task: Executing the query "SELECT cast(CUBE_XMLA as varchar(max))

FROM SSAS_TEST.CUBE_XMLA

WHERE (COUNTRY_CODE = '500') " failed with the following error: "/ROOT/*[local-name()="Batch" and namespace-uri()="http://schemas.microsoft.com/analysisservices/2003/engine"][1]/*[local-name()="Create" and namespace-uri()="http://schemas.microsoft.com/analysisservices/2003/engine"][1]/*[local-name()="ObjectDefinition" and namespace-uri()="http://schemas.microsoft.com/analysisservices/2003/engine"][1]/*[local-name()="Database" and namespace-uri()="http://schemas.microsoft.com/analysisservices/2003/engine"][1]/*[local-name()="Cubes" and namespace-uri()="http://schemas.microsoft.com/analysisservices/2003/engine"][1]/*[local-name()="Cube" and namespace-uri()="http://schemas.microsoft.com/analysisservices/2003/engine"][1]/*[local-name()="MeasureGroups" and namespace-uri()="http://schemas.microsoft.com/analysisservices/2003/engine"][1]/*[local-name()="MeasureGroup" and namespace-uri()="http://schemas.microsoft.com/analysisservices/2003/engine"][1]/*[local-name()="Source" and namespace-uri()="http://schemas.microsoft.com/analysisservices/2003/engine"][1]

Type '{http://schemas.microsoft.com/analysisservices/2003/engine}MeasureGroupBinding' is not found in Schema."

Does anyone know how to handle this?

If we could use this XML variable, we will use another Script task to generate our Local Cube(s). The script task looks like this:




Code Block
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.AnalysisServices.AdomdClient
Imports System.Data.SqlClient
Imports System.Xml
Public Class ScriptMain
' The execution engine calls this method when the task executes.
' To access the object model, use the Dts object. Connections, variables, events,
' and logging features are available as static members of the Dts class.
' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
'
' To open Code and Text Editor Help, press F1.
' To open Object Browser, press Ctrl+Alt+J.
Public Sub Main()
'Declare variables
'Connection
Dim conn As AdomdConnection
'Command
Dim cmd As AdomdCommand
'Cellset
Dim cst As CellSet
Dim strFilename As String = "D:TestLocal.cub"
Dim strSource As String = Dts.Variables("ASSLCreateScript").Value.ToString()
'*-----------------------------------------------------------------------
'* Open connection.
'*-----------------------------------------------------------------------
Try
' Create a new AdomdConnection object, providing the connection
' string.
conn = New AdomdConnection("Data Source=" & strFilename)
' Open the connection.
conn.Open()
Catch ex As Exception
Throw New ApplicationException( _
"An error occurred while connecting.")
End Try
Try
'*-----------------------------------------------------------------------
'* Open cellset.
'*-----------------------------------------------------------------------
' Create a new AdomdCommand object, providing the ASSL query string.
cmd = New AdomdCommand(strSource, conn)
' Run the command and return a CellSet object.
cst = cmd.ExecuteCellSet()
'*-----------------------------------------------------------------------
'* Release resources.
'*-----------------------------------------------------------------------
conn.Close()
Catch ex As Exception
' Ignore or handle errors.
Finally
cst = Nothing
cmd = Nothing
conn = Nothing
End Try
Dts.TaskResult = Dts.Results.Success
End Sub
End Class





I hope that someone can help us. We browse the net without result,

Thanks in advance.

View 5 Replies View Related

Trigger A Dataflow Based On Execute SQL Task Result

Jul 18, 2007



Hi,



I have a 'Execute SQL Task' in my 'control flow', my 'Execute SQL Task' will return a value which I am assigning to a variable. Based on the value of the variable, I need to control my other flows. If the variable's value is 1 then I should invoke a dataflow, else I should write a failure error message in event viewer. Please could someone provide some inputs on how this can be done.



'Execute SQL Task' ----->value 1 ------>data flow to be executed

'Execute SQL Task' ----->value !=1 ------> write some error message in the event viewer and no tasks should be executed after that.



Thanks

raj

View 1 Replies View Related

Is There Anyone Who Was Able To Successfully Retrieve A Full Result Set In Execute SQL Task?

Jun 6, 2007

Hi guys



Is there anyone who was able to successfully retrieve a full result set? I'm really having troubles getting the result after executing my query. Its really even hard to get sample codes over the net.



Please help guys.



Thanks in advance.



kix

View 6 Replies View Related

Execute SQl Task Return Decimal Type Result

Dec 3, 2007



I am trying to have an Excecute SQL Task return a single row result set executed on SQL Server 2005.


The query in the Execute SQL Task is:
select 735.234, 2454.123

I get a conversion error when trying to assign to SSIS variables of type Double.
I have nothing configured in the "Parameter Mapping" tab.
I have the two SSIS Double variables mapped to the Tesult Name 0 and 1 in the "Result Set" tab

I don't want to use a for loop enumerator since there is a single row returned.

I simply want to assign these two values to SSIS Double variables (double is the closest match)


I can't even hack this by converting the decimals as string and then using DirectCast to convert them to Double.

Thanks for the help

View 1 Replies View Related

Help! The Transaction Log Is Full Error In SSIS Execute SQL Task When I Execute A DELETE SQL Query

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

SSIS Hard Time Getting Back XML Return Data From Stored Procedure Call Executed By Execute SQL Task

Aug 9, 2006

I'm having a hard time to getting back an xml data back from a stored procedure executed by an Execute SQL task.

I'm passing in an XML data as a parameter and getting back resulting XML data as a parameter. The Execute SQL task is using ADO connection to do this job. The two parameters(in/out) are type of "string" and mapped as string.

When I execute the task, I get the following error message.

[Execute SQL Task] Error: Executing the query "dbo.PromissorPLEDataUpload" failed with the following error: "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 2 ("@LogXML"): Data type 0xE7 has an invalid data length or metadata length.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

I also tried mapping the parameter as XML type, but that didn't work either.

If anyone knows what's going on or how to fix this problem please let me know. All I want to do is save returning XML data in the parameter to a local package variable.

Thanks

View 10 Replies View Related

Which ConnectionType It's More Performance? ADO.NET Or OLEDB For Execute A Store Procedure In A SQL Task?

Nov 20, 2007

Hi, I'd like to know which is the best choice to execute a store procedure that execute transformations from table to files using bcp command, 2 millions rows everyday (i'ts a Data Warehouse database). So in the sql task in connectionType I had choiced ADO.NET is the best option?
Thanks

View 10 Replies View Related







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