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

SSIS script taks to open an existing Excel file, trigger a macro and then save and close Excel file.

$
0
0

Hi,

I found the following post: 

http://stackoverflow.com/questions/25126793/automate-process-by-running-excel-vba-macro-in-ssis

However it does not give enough detail of declaring the variables etc for me to set up a script to trigger a macro in an Excel workbook i have.

The filepath is: 

N:\Data sources\Reports\FT.xlsm

And the macro is called:

FileLoopingAddDates

Can anyone help with how to do this with C or VB script?

Thank you,

Q


QHarri


Not able to create the OLE DB connection in SSIS package.

$
0
0

Hi, This is Ashok. I work in In IT. I am facing a problem regarding OLE DB connection manager. Whenever I try to create the new OLE DB connection manager I got this error.

"Full path can only be retrieved when a TreeNode has been added to a TreeView. This TreeNode has not been added to a TreeView."

For more information please find the attachment. Please help on this. Thanks in advance.

SSISDB and packages that are running continuously

$
0
0

We have a series of packages created to process CDC data.  We are using SSISDB as our repository and we have logging level set to none. The jobs are created to run perpetually - run, process data, start again....

With logging set to none, these jobs are still filling SSISDB with log information, because none is still logging executions.

So is there another setting we can use in SSISDB to limit logging to the last n executions? Or do we need to modify our jobs and the way they run? Or do we just need to take these out of SSISDB

Any help or input is greatly appreciated.

Thanks!

-Bill S.

ssis 2012 configuration package wizard is hanging

$
0
0

Hi,

I am trying to edit the dtsconfig package xml file in SSIS 2012 VS envoirnemnt and the wizard is hanging up for minutes until I need to close VS.

Has anyone experienced this problem and what can be done to solve other than editing the XML file directly.


Should every Transformation have an error output?

$
0
0

Hi all,

In the data flow.... should every transformation be given an error output?

Many thanks,

Ben


Mr Shaw... One day I might know a thing or two about SQL Server!

dataflow cdc source??

$
0
0
For the dataflow cdc source object how do I get around it not having sql command options.  My original changes are coming from several tables into one.

LISA86

Saving and Displaying Table Names Using Foreach Loop Container

$
0
0

I am using a Foreach Loop Container to loop through a folder containing Excel workbooks. Each workbook has multiple pages, which eventually will be used to insert into tables. For now, I was just following the steps at this link (https://msdn.microsoft.com/en-us/library/ms403358.aspx#example4) to try to save the names of individual sheets in an Excel workbook to a string array and print them in a pop-up window for each iteration of the loop. I have a Foreach loop which is working correctly, containing 2 script tasks that contain the following code:

First script task (named "Get Excel Tables") contains:

#region Namespaces
using System;
using System.Data;
using System.Xml;
using System.Data.OleDb;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
#endregion

namespace ST_f8c4459dbcea4a0e9b366362ddc5fbe2
{
    /// <summary>
    /// ScriptMain is the entry point class of the script.  Do not change the name, attributes,
    /// or parent of this class.
    /// </summary>
	[Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
	public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
	{
		public void Main()
		{
            string excelFile;
            string connectionString;
            OleDbConnection excelConnection;
            DataTable tablesInFile;
            int tableCount = 0;
            string currentTable;
            int tableIndex = 0;

            string[] excelTables = new string[5];

            excelFile = Dts.Variables["User::StdizedFileName"].Value.ToString();
            connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +"Data Source=" + excelFile + ";Extended Properties=Excel 8.0";
            excelConnection = new OleDbConnection(connectionString);
            excelConnection.Open();
            tablesInFile = excelConnection.GetSchema("Tables");
            tableCount = tablesInFile.Rows.Count;

            foreach (DataRow tableInFile in tablesInFile.Rows)
            {
                currentTable = tableInFile["TABLE_NAME"].ToString();
                excelTables[tableIndex] = currentTable;
                tableIndex += 1;
            }

            Dts.Variables["User::ExcelTables"].Value = excelTables;

            Dts.TaskResult = (int)ScriptResults.Success;
		}

        #region ScriptResults declaration
        /// <summary>
        /// This enum provides a convenient shorthand within the scope of this class for setting the
        /// result of the script.
        ///
        /// This code was generated automatically.
        /// </summary>
        enum ScriptResults
        {
            Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
            Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
        };
        #endregion

	}
}

The second script task (named "Display Results") contains:

#region Namespaces
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
#endregion

namespace ST_a4f7b5b2436d43c7ac874d2506d026cd
{
    /// <summary>
    /// ScriptMain is the entry point class of the script.  Do not change the name, attributes,
    /// or parent of this class.
    /// </summary>
	[Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
	public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
	{
		public void Main()
		{
            const string EOL = "\r";

            string results = "";
            //string[] filesInFolder;
            //string fileInFolder;
            string[] tablesInFile;
            //string tableInFile;

            //results = "Final values of variables:" + EOL + "ExcelFile: " + Dts.Variables["ExcelFile"].Value.ToString() + EOL + "ExcelFileExists: " + Dts.Variables["ExcelFileExists"].Value.ToString() + EOL + "ExcelTable: " + Dts.Variables["ExcelTable"].Value.ToString() + EOL + "ExcelTableExists: " + Dts.Variables["ExcelTableExists"].Value.ToString() + EOL + "ExcelFolder: " + Dts.Variables["ExcelFolder"].Value.ToString() + EOL + EOL;

            //results += "Excel files in folder: " + EOL;
            //filesInFolder = (string[])(Dts.Variables["ExcelFiles"].Value);
            //foreach (string fileInFolder in filesInFolder)
            //{
            //    results += " " + fileInFolder + EOL;
            //}
            //results += EOL;

            results += "Excel tables in file: " + EOL;
            tablesInFile = (string[])(Dts.Variables["User::ExcelTables"].Value);
            foreach (string tableInFile in tablesInFile)
            {
                results += " " + tableInFile + EOL;
            }

            MessageBox.Show(results, "Results", MessageBoxButtons.OK, MessageBoxIcon.Information);

            Dts.TaskResult = (int)ScriptResults.Success;
		}

        #region ScriptResults declaration
        /// <summary>
        /// This enum provides a convenient shorthand within the scope of this class for setting the
        /// result of the script.
        ///
        /// This code was generated automatically.
        /// </summary>
        enum ScriptResults
        {
            Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
            Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
        };
        #endregion

	}
}

When I execute the code, I get the following error:

Exception has been thrown by the target of an invocation:

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()

Please let me know how to overcome this issue.

Thank you!

import a CSV file to split one column to two

$
0
0

I need import a CSV file into SQL Server using SSIS.

There is one field on the CSV file is 2 columns in SQL table.

I place a flat file source on the data flow, it give me all the columns.

I do not see any where I can enter a function or user interface to split one column in to two, for example, left(MyField,2) as MyField1, right(MyField,1) as MyField2.

Your information and help is great appreciated,

Regards,

Sourises,


SQL Server Agent can't access files on an another server.

$
0
0



I have an SSIS package that includes several scripts that read and right files on a server other that the SQL Server server.  Tha package runs fine when executing the solution manually.  I set up an agent to run the package several times a day. The DBAs created a command that toggles the ownerhip of the job between me and SYSADMIN so the job can run as SYSADMIN and not require credentuials. All that was well and good, but because the scripts read, write and delete files on another server, the job fails if scheduled.

I tried executiing the package with Windows Scheduler, but in order to create an Integration Services catalog, CLRs have to be enabled, and our site doe not have that luxury for security reasons.

Any deas how I can accomplish this?

Thanks


Jnana Sivananda




SSIS - export very large data to flat file

$
0
0

Hello,
I have a stored procedure that returns a very long text (more than 2 billions characters - actually it's an input for xml). I have a data flow with two components: OLE DB Source Editor and Script Component. The first one gets data from the stored procedure and the second one is supposed to write data to a flat file (with xml extension).

Here is the main part of my code from the Script Component:

    Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)

        Dim blobLength As Int32
        Dim blobColumn As BlobColumn
        Dim stringData As String
        Dim blobData As Object

        blobColumn = inputBuffer.Item(0)

        blobLength = Convert.ToInt32(blobColumn.Length)
        blobData = blobColumn.GetBlobData(0, blobLength)
        stringData = Encoding.Unicode.GetString(blobData)

        File.WriteAllText("G:\JPK\WB.xml", stringData, Encoding.UTF8)
    End Sub

It works well for data up to 2 billions characters, but returns error for larger data.

The error is:
Failed to retrieve long data for column "COL_XML"
There was an error with sp_JPK_WB_eksport.Outputs[OLE DB Source Output].Columns[COL_XML] on sp_JPK_WB_eksport.Outputs[OLE DB Source Output]. The column status returned was: "DBSTATUS_UNAVAILABLE".

I have tried "bcp" command in t-sql but it doesn't support utf8.

I will appreciate any help.
Thank you.

Kacper

Excel Upload to MSSQL

$
0
0

how to upload excel file to mssql server table.

CustomerCode1101029160
12534
35611


Table Structure

Customercode  int

Itemcode int

Qty int

please help me.

ssis c# script to process data

$
0
0

Hello,
The varchar(max) column of tbl1 is populated with data from a comma delimited .csv file data...
How can C# process each line at a time inside the varchar(max) column.
Thank you

unable to find error message preventing deployment of package to SSIS

$
0
0

when deploying an SSIS package I get a deploy error, I am using Visual Studio 2013 Update 5 to deploy a package to SQL.
The default accounts were not used, AD accounts were used.  I am running visual studio from a laptop and SQL is on a server.  The account I am running Visual Studio under is an SQL admin account and I manually added them as a SSIS Admin.:

TITLE: SQL Server Integration Services
------------------------------

Failed to deploy project. For more information, query the operation_messages view for the operation identifier '8'. (Microsoft SQL Server, Error: 27203)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=12.00.4213&EvtSrc=MSSQLServer&EvtID=27203&LinkId=20476

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

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

The problem with this is that the table is empty.

I found some thing under catalog.operations where I see the attempts to do something but no error messages.

Checked:

catalog.operations (shows attempts with no success or fail flag)
catalog.operation_messages (empty)
catalog.projects (empty)
catalog.event_messages (empty)

Something is up I just don't know what.

help?

VS Excel Destination - Re input data access mode every time

$
0
0

I'm trying to export data from a SQL query into excel with Visual Studio. While I have it open, I set up everything in excel destination editor and it works. However if I save and close out, and then come back in, it has an error and says that no tables or views could be loaded. It's giving me issues because I cannot get it to run automatically because of this.

Does anyone know how I can get it to save?

Sql Server Agent Job Option grayed out

$
0
0
I deployed package to sql server and want to schedule a job. The option "Run as" is grayed out.

SSIS Transactions issue

$
0
0

Hi Everyone,

This is regarding one of the issue in PROD environment.

We have recently implemented SSIS transactions in one of the SSIS package and is working in all the internal environments including PRE-PROD but when we have deployed this package in PROD environment and started executing, it is throwing the attached exception.

We are thinking that the attached exception is misleading us and suspect MSDTC settings is the root cause of the issue when we have debugged further. The SSIS package is started working when we have reverted the SSIS transactions settings (changed the Sequence container property from Required to Supported)

PROD MSDTC settings are matching with the internal environments including PRE-PROD.

Appreciate your help.



Bulk insert operation on remote computer

$
0
0

I have a SSIS package to import a CSV data file in to my SQL server table.

I have CSV file on my local machine and need insert in to a remote computer server.

I got that Bulk insert operation can not perform on remote computer,

I would like to know is it SSIS design to limit user to bulk insert data to remote server or this is SQL Server user rights to limit users.

If it is SSIS design then I should be able to insert in to my local developer server then insert in to production remote server.

Your information and help is great appreciated,

Regards,

Sourises,

How can I embed commas with double quotes when exporting .csv file?

$
0
0

Hi, having a bit problem when I am trying to export data from .xlsx file to .csv file.The root cause is because some fields contains comma in the data, and i want to export that kind of cells with double quotes.For example, a cell value isJohn, Smith. I want export it into csv as"John, Smith" so that when my another application reads this csv file, it won't split the name into two cells.

I noticed if I manually save the .xlsx as .csv in EXCEL, it works perfectly. But in SSIS, the name will be wrote into csv without double quotes. I know I can use Derived Column to embed every cell with double quotes; but it's just NOT COOL and UGLY.

Anybody has any clue if it's a possible mission or not? Thanks.

How to set ForceExecutionResult value during runtime?

$
0
0

Hi,

I am trying to get the ForceExecutionResult value of the package during runtime based on a dynamic variable.

I created a variable that is getting updated during runtime according to the data flow logic. The default value of the variable is -1 (equals 'None' in ForceExecutionResult property). On specific scenario the variable changes to 0 (Success).

I set an expression on a ForceExecutionResult property and placed my variable in it.

Now I expect to receive 0 (success) in ForceExecutionResult property when my variable is being updated to 0 during runtime. Unfortunately the ForceExecutionResult property doesn’t seems to get the variable during runtime. It always gets only the default value (-1).

I made sure that the variable is getting the new value in a runtime and it is.

How can I change the ForceExecutionResult value during runtime?

SSIS Connectivity Issue

$
0
0

hello ,

I am new to SSDT and is installed on Windows 10 and using SSIS  to connect to a SQL server to pull data. While creating a SQL connection and on testing it I am getting below error message :

Test connection failed because error in initializing provider. The .NET Framework OLEDB Data Provider requires Microsoft Data Access Components(MDAC) version 2.6 or later. Version 2.12.4202.3 was found currently installed.


I browsed though various article and it said I need to install MDAC 2.8 version but this seems to be not working too.
Please help me as I need to start working on a new project immediately.
Thanks,
Imran Khan
Viewing all 24688 articles
Browse latest View live




Latest Images