Quantcast
Channel: SQL Server Integration Services forum
Viewing all 24688 articles
Browse latest View live

SqlAgent jobs logging

$
0
0

SQL Server 2008 R2

In SQL Agent, the logging detail is essentially pass/fail. On pass, we would like some additional details such as row counts, databases processed, etc. How to add logging statements or log entries is not at all obvious.

Any ideal will be welcomed.


Mapping Stored Procedure output parameters to To package Variables

$
0
0

I am currently trying to map the output parameters of a stored procedure to variables in a package. However when I run the package I get the following error

Error: 0xC002F210 at SQL_LoadThresholdVariables, Execute SQL Task: Executing the query "EXEC [dbo].[AssignWorkVariables]  ? OUTPUT, ?  OUT..." failed with 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.

Task failed: SQL_LoadThresholdVariables

My stored procedure definition is as follows:

 

USE [AutoMatch]
GO
/****** Object:  StoredProcedure [dbo].[AssignWorkVariables]    Script Date: 3/25/2013 2:50:50 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[AssignWorkVariables]
(
@WT_WEIGHT NUMERIC(3,2) OUTPUT,
@WT_Similarity NUMERIC(3,2) OUTPUT,
@WT_Confidence NUMERIC(3,2) OUTPUT,
@WPerf_WEIGHT NUMERIC(3,2) OUTPUT,
@WPerf_Similarity NUMERIC(3,2) OUTPUT,
@WPerf_Confidence NUMERIC(3,2) OUTPUT
)
AS
SELECT       
 @WT_WEIGHT = MAX(CASE WHEN [FieldName] = 'Title' AND ParameterSetID = 6 THEN [Weight] END), 
 @WT_Similarity = MAX(CASE WHEN [FieldName] = 'Title' AND ParameterSetID = 6 THEN [SimilarityThreshold] END) ,
 @WT_Confidence= MAX(CASE WHEN [FieldName] = 'Title' AND ParameterSetID = 6 THEN [ConfidenceThreshold] END),
 @WPerf_WEIGHT=MAX(CASE WHEN [FieldName] = 'PerformingArtist' AND ParameterSetID = 6 THEN [Weight] END), 
 @WPerf_Similarity=MAX(CASE WHEN [FieldName] = 'PerformingArtist' AND ParameterSetID = 6 THEN [SimilarityThreshold] END),
 @WPerf_Confidence=MAX(CASE WHEN [FieldName] = 'PerformingArtist' AND ParameterSetID = 6 THEN [ConfidenceThreshold] END)
FROM        dbo.Thresholds
WHERE     (ParameterSetID = 6)

In the sql task I have the ResultSet = None

My sql statement is as follows:

EXEC [dbo].[AssignWorkVariables]  ? OUTPUT, ?  OUTPUT, ? OUTPUT,? OUTPUT, ? OUTPUT, ? OUTPUT

I have mapped the parameters using variables defined in the package. This is shown below:

Not sure what I am doing wrong. Any ideas?

 

 

 

 

  

elegant way out of the data source warnings after coding pkgs

$
0
0

Hi.  We run STD 2008 and for one particular master with 36 subpackages perhaps wish we'd never used data sources. 

They are convenient for development but obnoxious when you go to open under VSS and get the pop up sync warnings.

We're also using a config file extensively in this package.  So all connection info is passed down to subs via config'd variables anyway.

I dont even think much is different between the ds's and config'd values except perhaps for case....maybe order of params too.

Is there an easy way out once the development is done?  Perhaps breaking the expectation by ssis en masse that ds's are no longer to be tied to connection managers?   If not what is the safest difficult way out? 

db042188




Problem loading SSIS project parameters out of Project.params file

$
0
0

Hi,

I'm trying to load and validate dtsx packages in an C# application, which are created in an SSIS project of SSDT in Visual Studio 2010. Therefore I'm using theMicrosoft.SqlServer.ManagedDTS.dll assembly version 11.0.0.0. First I'm loading the packages (dtsx files). Then I'm loading the connnection manager files (conmgr files). At least I'm trying to load the project parameters in the Project.params. For this (and for the other loading procedure) I'm using the LoadFromXml methods. In this case the LoadFromXml method of Microsoft.SqlServer.Dts.Runtime.Parameter. My code looks like this:

                // load file Project.params
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(File.ReadAllText(paramFileName));

                // namespace is necessary
                XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable);
                ns.AddNamespace("SSIS", "www.microsoft.com/SqlServer/SSIS");

                // extract all ssis project parameters
                XmlNodeList list = doc.SelectNodes("/SSIS:Parameters/SSIS:Parameter", ns);
                foreach (XmlNode node in list)
                {
                    // initialize a new parameter with defaults
                    Parameter param = package.Parameters.Add("DEFAULT", TypeCode.Boolean);

                    // set parameter values out of xml node
                    param.LoadFromXML(node, null);  // <- a DtsRuntimeException is thrown with HRESULT: 0xC0011001 
                }

The DtsRuntimeException is thrown because Project.params file defines other namespace(www.microsoft.com/SqlServer/SSIS) with SSIS:Parameter inclusive other syntax instead of (for test purpose) param.SaveToXML(...) which creates XML content of namespacewww.microsoft.com/SqlServer/Dts and DTS:PackageParameter.

My question is, how can I load all project parameters out of Project.params file in an C# application so I can use it in Microsoft.SqlServer.Dts.Runtime.Package objects for validation (inclusive sensitive parameter with encryption)? Exist another method (in other assembly) for loading project parameters? Exist other way for satisfy my needs?

Regards, Thomas

Flag Rows as imported after data is inserted into destination table

$
0
0

Hi All,

I have an excel files which I am importing into a staging table with added columns of datatime and importedflag.

I have then written SSIS package to import the data from staging table into the database.

Based on the import done I want the importedflag to be set to one for that particular row.

E.g

Data in staging table after importing from excel file is as follows

column1               column2                importeflag

1                             abcd

1                            edfg

3                             hijk

4                             xyz

SSIS package runs and import 3 rows and is not able to import the 4th rows so after the package has finished data in staging table so be as follows:

column1               column2                importeflag

1                           abcd                           1

1                           edfg                           1

3                          jkwer                          0

4                          xyz                             1

Thanks in advance.

Aash.


Aash

How to generate unique IDs with XML Source to OLE DB Destination inside Foreach Container

$
0
0

I have a Data Flow Task that contains an XML Source which writes to a SQLServer database.

It writes as expected with a single source file. 

In a Foreach container it writes multiple files as expected...

...however the auto-generated record IDs reset on each iteration of the Foreach container, creating duplicate ids instead of uniquely identified rows.

e.g., file #1 is processed and IDs 1, 100, 200 are written to tie the OLE DB destination tables together.  Then file #2 is started, and the IDs 1, 100, 200 are reused and the table relations are no longer valid.

I'm using VS2008.  Please and thank you for any assistance.  Michael

Consolidating data from two separate secure environments

$
0
0

Hi All,

I hope someone can help me.  I've recently been tasked with developing an SSIS package to consolidate data contained on two separate servers.  The data collected from each can only be moved to either server by FTP.

This means that SSIS can't connect to either server by using Server credentials.  The steps that I'm trying to achieve are below:
1. SSIS extracts data from Secure Server 1 and Secure Server 2

2. Data is consolidated into one or more tables

3. Data is delivered to SQL Server tables that are identical within both Secure servers

4. Users from both environments can safely connect to the data in each of their environments 

My concern is that I need a SSIS package on each server extracting data, then using FTP to transfer data between the two Servers, then using SSIS to consolidate and then, again, using FTP to transfer results to each server, and once more, using SSIS to import to SQL Tables within the respective Servers.

My concern is TIMING! if I need two SSIS packages, is there a way to trigger SSIS from one server to another using FTP or what is the most effective way achieve my goal?

Any help would be much appreciated.

Thanks

Retrieving the COM class factory for component with CLSID {BA785E28-3D7B-47AE-A4F9-4784F61B598A} failed due to the following error: 80070005

$
0
0
 I have created an executable in C# and Im using SSIS API (Microsoft.SQLServer.ManagedDTS) to execute a package that exports data to excel on Windows 2008 with SQL Server 2008 installed.  I have compiled my executable using X86 so that I can execute in 32bit mode on Windows 2008.  On execution,I receive the following error message below.  The error happens on the following line. 

using Microsoft.SqlServer.Dts.Runtime;

Application integrationServices = new Application();


Error:

System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {BA785E28-3D7B-47AE-A4F9-4784F61B598A} failed due to the following error: 80070005.
   at Microsoft.SqlServer.Dts.Runtime.Application..ctor()


bcp in Format File to Accept NULL for MONEY

$
0
0

I get error when it hits NULL for a MONEY columns 2006, 2007, 2008:

Error = [Microsoft][SQL Server Native Client 11.0]Invalid character value for cast specification

How do I change the format file? Thanks.

Format file:

11.0
7
1       SQLCHAR             0       12      ","      1     SalesPersonID                    ""
2       SQLCHAR             0       304     ","      2     FullName                         SQL_Latin1_General_CP1_CI_AS
3       SQLCHAR             0       100     ","      3     JobTitle                         SQL_Latin1_General_CP1_CI_AS
4       SQLCHAR             0       100     ","      4     SalesTerritory                   SQL_Latin1_General_CP1_CI_AS
5       SQLCHAR             0       30      ","      5     2006                             ""
6       SQLCHAR             0       30      ","      6     2007                             ""
7       SQLCHAR             0       30      "\r\n"   7     2008                             ""


Kalman Toth Database & OLAP Architect sqlusa.com
Paperback / Kindle: SQL Programming & Database Design Using Microsoft SQL Server 2012


SSIS package failed after test connection success

$
0
0

, Test Connection succesfull, can preview the sample data, destination connection succesfull, but getting the following error on execution

TITLE: Microsoft Visual Studio
------------------------------

Error at Load Data from Oracle to SQL Server [SQL Srvr 2008 R2  DB Destination [1896]]:
An error occurred due to no connection. A connection is required when requesting metadata.
If you are working offline, uncheck Work Offline on the SSIS menu to enable the connection.

 

------------------------------
ADDITIONAL INFORMATION:

Exception from HRESULT: 0xC0202022 (Microsoft.SqlServer.DTSPipelineWrap)

------------------------------
BUTTONS:

OK
------------------------------

SSIS ForEach Loop

$
0
0

HiAll,Good Morning

Need Small help with SSIS

Ihave 2 foreach loopstoprocessincomingfiles basedontheserver(Devortest)

Wheniexecute  first foreachloophasfiles itpicksupthemand processesthefiles

andthoughtheir arefilesfor 2ndForeachits notpickingupthem

butifi executethepackagenext timeitspickingupthem andprocessingthemthistime..


Rohan


Attunity Error in SSIS - "OCI Error Encouneterd"

$
0
0

I have SSIS BIDS (SQL Server 2008) (32 bit), and am using Attunity connector to connect to an Oracle DB. A while back we had our systems upgraded to windows 7 64 bit.

I have installed Oracle 11g client on my machine, added TNS entries for the above Oracle server connection and also pointed this path (path for TNSNames.ORA) in the "PATH" environment variable as well as "TNS_ADMIN" (which I created) environment variable.

Even after doing all this, I get the following error when validating the Attunity Oracle source connector, the error is as follows:

"OCI Error Encouneterd. ORA-12154: TNS could not resolve the connect identifier specified, Test connection failed".

I also researched that this might be due to paranthesis in the path for devenv.exe (BIDS).... So I went through the following post, installed JUNCTION, and created a junction pointing to the actual directory for devenv.exe.

http://danieladeniji.wordpress.com/2011/08/03/microsoft-sql-server-integration-services-attunity-error-oci-error-encountered-ora-12154-tnscould-not-resolve-the-connect-identifier-specified/

This too has not resolved the problem....

Any help appreciated!!

reading excel 2007 using oledb in ssis

$
0
0

Hello All,

Can anyone help me how to read excel 2007 (.xlsx) file using OLEDB in SSIS without using script component? If it cannot be done without using script component then please provide me the code for the same?

Its really urgent friends. Please send me your answers.

Thanks,

NavMac

SSIS: Odd Connection Error after upgrading to SQL 2012

$
0
0

Configuration Summary:

I have a SSIS package that was running fine on SQL2008R2 using Environmental Variables pointing to a configuration file for connection strings.
The ProtectionLevel of the package is set to "DontSaveSensitive".

Issue:

After upgrading to SQL2012, I upgraded the package using VS2010 Shell and left it in package deployment model. When I try and run the package in VS, I am getting the following errors at the first Data Flow Task it reaches:

[OLE DB Destination [2]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "DB_Connection" failed with error code 0xC0202009.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.

[SSIS.Pipeline] Error: OLE DB Destination failed the pre-execute phase and returned error code 0xC020801C.

The part that is really throwing me is that earlier in the package, the same "DB_Connection" manager is used successfully in a number of Execute SQL Tasks. So, it seems the connection strings are being read from the configurations correctly.

Any help anyone can give to point me in the right direction will be much appreciated. I would prefer to not have to move to a project deployment model at this time if I do not have to.

SCD type 1 using staging table

$
0
0

Hi All,

I am working on dim/fact tables loading through SSIS 2012 and I have couple on questions on this.

Firstly, we all know ole db command is too slow for performing updates. So the work around is to use staging table (which I am using). The updates should be stored in the staging table and then updated in Dim table with join between staging and final Dim table. I am using the same approach for SCD type 1 Dim.

My ques is that I see some links that use checksum function to determine the changes. But if I dont use checksum and simply use lookup task for identifying changed/new records (based on the business key), is that correct? Here's the screen shot

The control of the pkg is


Thanks, hsbal


SSIS Package Failing Inconsistently with "Phantom" Error

$
0
0

We have multiple subject areas we load through multiple independent SSIS packages. Each SSIS package is comprised of a Master Package and then subsequent Child packages.

The Master Package calls a stored proc which writes a record to our table DimAudit. This tracks when the overall load begins and ends. a ProcessID is returned and is used to track the entire load. Each Child package calls another stored proc which writes a record to our LogTask table (including ProcessID) to track the smaller steps within the overall Master package.

We Execute the SSIS job via SQL Server Agent. Usually everything works well but we are beginning to experience an increasing number of "phantom" errors. Here is the error message:

Executed as user: IHA\.service-SQL. ... Version 9.00.5000.00 for 64-bit  Copyright (C) Microsoft Corp 1984-2005. All rights reserved.    Started:  7:55:55 AM  Error: 2012-12-12 07:59:08.72     Code: 0x00000000     Source: SQL-pLogTaskStart      Description: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_LogTask_DimAudit". The conflict occurred in database "Common", table "dbo.DimAudit", column 'ProcessID'.  End Error  Error: 2012-12-12 07:59:09.25     Code: 0xC002F210     Source: SQL-pLogTaskStart Execute SQL Task     Description: Executing the query "pLogTaskStart ?, ?" failed with the following error: "The statement has been terminated.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.  End Error  DTExec: The package execution returned DTSER_FAILURE (1).  Started:  7:55:55 AM  Finished: 8:08:39 AM  Elapsed:  763.922 seconds.  The package execution failed.  The step failed.

This error does not occur on the same child package all the time (in fact the error happens in different loads altogether). It looks to be random. Usually we simply restart the job without making any changes and it works. 

Any ideas from anyone? Any questions at all I can give more information I just don't want to start off to TL;DR.

Thanks!!

Can a machine be too fast?

$
0
0

SQL 2008 (duel Processers, 10GB Ram)

I have a dataflow script task that I am using as a data source. ( code and errors below) . If I run the task normally, I get an error

Exception from HRESULT: 0xC0010009
 at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSVariables100.get_Item(Object Index)
   at SC_0f2a4d25b8134b2fa78c6f297534c16b.Variables.get_ForEachReportLicnece()
   at SC_0f2a4d25b8134b2fa78c6f297534c16b.ScriptMain.PreExecute()
   at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute

After some head scratching, I put a message box in my script to check the 'licence' and the result was correct and there was no error, however if I take that message box our  I get the error again. If I put a break point in the code, and just continue after hitting the breakpoint no error. Im at a loss as to what the problem is.

Code

Public Class ScriptMain
    Inherits UserComponent
    Dim connMgr As IDTSConnectionManager100
    Dim sqlConn As SqlConnection
    Dim sqlCmd As SqlCommand
    Dim sqlParam As SqlParameter
    Dim sqlReader As SqlDataReader
    Dim RTNINT As Integer
   Public Overrides Sub AcquireConnections(ByVal Transaction As Object)
        connMgr = Me.Connections.CBFConnection
        sqlConn = CType(connMgr.AcquireConnection(Nothing), SqlConnection)
    End Sub
    '
    'You can remove this method if you don't need to do anything here.
    Public Overrides Sub PreExecute()
        MyBase.PreExecute()
        sqlCmd = New SqlCommand("sp_GetArudd_nonCBI", sqlConn)
        sqlCmd.CommandType = CommandType.StoredProcedure
        sqlParam = New SqlParameter("@ret_val", SqlDbType.Int)
        sqlParam.Direction = ParameterDirection.ReturnValue
        sqlParam.Value = RTNINT
        sqlCmd.Parameters.Add(sqlParam)
        sqlParam = New SqlParameter("@FileName", SqlDbType.NVarChar, 250)
        sqlParam.Direction = ParameterDirection.Input
        sqlParam.Value = Me.Variables.xmlFileName
        sqlCmd.Parameters.Add(sqlParam)
        sqlReader = sqlCmd.ExecuteReader
    End Sub
    ' This method is called after all the rows have passed through this component.
    '
    ' You can delete this method if you don't need to do anything here.
    Public Overrides Sub PostExecute()
        MyBase.PostExecute()
        sqlReader.Close()
    End Sub
    Public Overrides Sub CreateNewOutputRows()
        If sqlReader.HasRows Then
            Dim I As Integer = 0
            While sqlReader.Read
                If I < 1 Then
                    HeaderBuffer.AddRow()
                    Me.HeaderBuffer.Licence = sqlReader.GetString(sqlReader.GetOrdinal("licence"))
                    '       MsgBox(sqlReader.GetString(sqlReader.GetOrdinal("licence")))
                    Me.HeaderBuffer.contentlink = sqlReader.GetString(sqlReader.GetOrdinal("contentlink"))
                    Me.HeaderBuffer.reporttype = sqlReader.GetString(sqlReader.GetOrdinal("reporttype"))
                    Me.HeaderBuffer.advicenumber = sqlReader.GetString(sqlReader.GetOrdinal("advicenumber"))
                    Me.HeaderBuffer.reportproceddingdate = sqlReader.GetDateTime(sqlReader.GetOrdinal("reportproceddingdate"))
                    Me.HeaderBuffer.reportdebitdate = sqlReader.GetDateTime(sqlReader.GetOrdinal("reportdebitdate"))
                    Me.HeaderBuffer.username = sqlReader.GetString(sqlReader.GetOrdinal("username"))
                    Me.HeaderBuffer.usernumber = sqlReader.GetString(sqlReader.GetOrdinal("usernumber"))
                    Me.HeaderBuffer.accountname = sqlReader.GetString(sqlReader.GetOrdinal("accountname"))
                    Me.HeaderBuffer.number = sqlReader.GetString(sqlReader.GetOrdinal("number"))
                    Me.HeaderBuffer.sortcode = sqlReader.GetString(sqlReader.GetOrdinal("sortcode"))
                    Me.HeaderBuffer.accounttype = sqlReader.GetString(sqlReader.GetOrdinal("accounttype"))
                    Me.HeaderBuffer.bankname = sqlReader.GetString(sqlReader.GetOrdinal("bankname"))
                    Me.HeaderBuffer.branchname = sqlReader.GetString(sqlReader.GetOrdinal("branchname"))
                    Me.HeaderBuffer.numberofitems = sqlReader.GetInt32(sqlReader.GetOrdinal("numberofitems"))
                    Me.HeaderBuffer.valueofitems = sqlReader.GetDecimal(sqlReader.GetOrdinal("valueofitems"))
                End If
                BodyBuffer.AddRow()
                Me.BodyBuffer.contentlink = sqlReader.GetString(sqlReader.GetOrdinal("contentlink"))
                Me.BodyBuffer.rdiref = sqlReader.GetString(sqlReader.GetOrdinal("rdiref"))
                Me.BodyBuffer.rditranscode = sqlReader.GetString(sqlReader.GetOrdinal("rditranscode"))
                Me.BodyBuffer.rdireturncode = sqlReader.GetString(sqlReader.GetOrdinal("rdireturncode"))
                Me.BodyBuffer.rdireturndescritpion = sqlReader.GetString(sqlReader.GetOrdinal("rdireturndescritpion"))
                Me.BodyBuffer.rdiorigionalprocessingdate = sqlReader.GetDateTime(sqlReader.GetOrdinal("rdiorigionalprocessingdate"))
                Me.BodyBuffer.rdivalueof = sqlReader.GetDecimal(sqlReader.GetOrdinal("rdivalueof"))
                Me.BodyBuffer.rdicurrency = sqlReader.GetString(sqlReader.GetOrdinal("rdicurrency"))
                Me.BodyBuffer.panumber = sqlReader.GetString(sqlReader.GetOrdinal("panumber"))
                Me.BodyBuffer.paref = sqlReader.GetString(sqlReader.GetOrdinal("paref"))
                Me.BodyBuffer.paname = sqlReader.GetString(sqlReader.GetOrdinal("paname"))
                Me.BodyBuffer.pasortcode = sqlReader.GetString(sqlReader.GetOrdinal("pasortcode"))
                Me.BodyBuffer.pabankname = sqlReader.GetString(sqlReader.GetOrdinal("pabankname"))
                Me.BodyBuffer.pabranchname = sqlReader.GetString(sqlReader.GetOrdinal("pabranchname"))
                I += 1
            End While
            BodyBuffer.SetEndOfRowset()
            HeaderBuffer.SetEndOfRowset()
        Else
            ' throw error
        End If
    End Sub

 


Dont ask me .. i dont know

SSIS Expression task can't see variables populated by a containing foreach loop

$
0
0

I'm trying to collect a list of file paths from a directory, concatenate them together and then send that value to an execute process task. To do this, I'm using a ForEach loop with an expression task inside that is supposed to stuff the path from each iteration of the loop into a variable. The problem is that when the expression task runs it throws the following error.

Error: The type of the value (Empty) being assigned to variable "User::CombinedPath"
differs from the current variable type (String). Variables may not change type
during execution. Variable types are strict, except for variables of type Object.

The expression task is basically doing this:

@[User::PathFromForEach]+";"

However, it appears that @[User::PathFromForEach] is coming in empty.

What's going on here?

Users cannot open SSIS projects and cannot create maintenance plans after installing CU3 for SQL Server 2012 SP1

Processing header and detail rows flat file

$
0
0

Afternoon,

I was wondering if anyone could help me with some really simple examples of how to process a file with headers and lines, I have seen some examples but as I'm really new to all this they don't make much sense.

If we take a example file that looks something like this:-

"H", "1", "SomeData", "26/03/2013"

"L", "10001239", "154", "23/03/2013", "19/03/2013"

"L", "10001240", "169", "23/03/2013", "19/03/2013"

"H",  "2", "SomeMoreData", "27/03/2013"

How would I go about processing this file using SSIS?  On the header line the second value is the ID field and needs to be included when the lines information is inserted into the database.  The header lines need to go to one database table lets call it TBL_Headers and the lines need to go to TBL_Lines. 

Any help, advice, very simple Janet and John examples would be great.

Thank you in Advance

Andy

Viewing all 24688 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>