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

How change rquired field to optionnel SSIS batch file

$
0
0
Hello,

How can i make required column to optionnel in batch file

Cordially

SSIS 2016 Flat File with Text Qualifier has a issue

$
0
0

We have a CSV file which we get data like below, because of double quotes in the column C we received this error. We are using SSIS 2016 to import files, is there anyway to handle this without using Script Component as a source.

I don't have control on Source file and I have to accept this file as-is.

A,B,C,D

"1","2","Abcde"fghijklmnopqrst","3"

"1","2","Abcde,","3"

The column delimiter for column "C" was not found.


How to setup auto delete function in SQL Server to run every Monday morning

$
0
0
I would like to have my table reset every Monday morning any one with a certain incident.  

Deleting lines in flat file

$
0
0

I have a text file something like this:

T01

Data line 1

Data line 2

T02

Data line 1

Data line 2

Data line 3

T03

Data line 1

T04

Data line 1

Data line 2

If line contains T02, then delete the line of "T02" and lines after before the line of "T03". If line contains "T04", then delete line of "T04" and lines after. Output will be:

T01

Data line 1

Data line 2

T03

Data line 1

I will use the script task and VB.net code to loop through the text file searching for lines containing those values and de the deletion. 

Thank you

SSIS Execute Process Task to PGP Encrypt a File and SQL Server Agent Job

$
0
0

Our SSIS Solution to PGP Encrypt a File and WinSCP to a Secured FTP Server works perfectly locally running through Microsoft Visual Studio.

Even our local version which we are using manually right now to create Production files is using our remote server and the executable that sits on the remote server.

Executable: \\(Remote Server)\c$\GnuPG\gpg.exe

And the Argument is working fine locally too.

--recipient "Key Name" --trust-model always --output "\\(File Share Path)\FileName.dat.pgp" --encrypt "(File Share Path)\FileName.dat"

Why oh why does this fail when setting up the SQL Server Job Agent?

The Job Step is set-up to run as Type: SQL Server Integration Services Package

Run as: SQL Server Agent Service Account

Like I said, locally we are simulating running this exact executable \\(Remote Server Name\c$\GnuPG\gpg.exe and it is working just fine

I'm about ready to tear my hair out...what little I have left...as to why the SQL Server Agent Job is failing.

What am I missing here?

I did come across a web site which talks about setting up a proxy account...blah...blah...blah...but do I really need to set that up in this instance?

Thanks for your review and am praying and hopeful for a reply.

Select in the same table twice in the same data flow

$
0
0

Hi,

I have the follow situation: I have a Stage Table that store tickets from many customers. I use a Data Flow with a `Ole DB Source' to do a full select in the stage. The problem is that I have a few possible status values for a ticket, but one of these possible values ( value 99 ) is 'invalid' to the rule, so I need to go through the previous rows of the customer in the stage table until I find a value different of this 'status 99' and fill the status value with the previous valid status.

The customer tickets with status 99 need to be selected and need to have their status changed to the previous ticket of this customer,cannot be excluded from the fact table

The stage can have 1, 2, 5, even 1000 rows consecutively with the same invalid state, so LAG() is not a choice.

Lookup is not a choice because I need 'Order By' date.

Merge Join in the fact table is impossible because I need the real data state, not buffer state

I have millions of registers daily, so decrease the data flow buffer to 1 row is not a choice. I work with 10000 rows in the buffer.

I already resolved this question with a SQL Cursor changing these invalid values in the stage table, before insert in the Fact Table, but the problem is the Update operation is very, very, very slow. So I want to change these status in the data flow that select from stage table and insert in the Fact Table.

To illustrate:

Before:

date   status
10:01  45
10:03  57
10:06  99
10:09  99
10:15  13
10:37  12
10:52  99
10:58  99
11:03  99
11:08  99
11:15  33

After:

date   status
10:01  45
10:03  57
10:06  57
10:09  57
10:15  13
10:37  12
10:52  12
10:58  12
11:03  12
11:08  12
11:15  33

The most efficent approach I think it is do somehow a second select in the stage table on this data flow for every invalid value, avoiding do slow updates. But how to do this second select?

Best Regards,
Luis


Communication link error

$
0
0

I am facing the above error while inserting using ssis. the error is raised after inserting some rows.

How to Insert to Specific Column of Excel

$
0
0

Hi All,

Would like to get advise how we insert to specific Column of Excel. my script is to get total after execute store procedure and insert to L2 as shown below (Beside Total).


I tried to select specific column from the [excel$] but it get error as below and the DTSX file auto close 

Kindly Advise.




How to handle table access quickly in case it have huge amount of Data ?

$
0
0

Problem

I work on SQL server 2012 I have table have 300 hundred million rows

when select from table any records it is too much heavy

I need any way can enhance performance of table at least if i select small amount of data as 1000 rows

can be access quickly and not take too much time

so if there are any idea i can accept to access this table quickly

because when select data it is hanging and take too much time to show data ?

so how to do that please ?

CREATE TABLE [Parts].[Nop_Part](
	[PartID] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
	[PartNumber] [nvarchar](70) NOT NULL,
	[PartNumberNon] [nvarchar](60) NOT NULL,
	[CompanyID] [int] NOT NULL,
	[Active] [bit] NOT NULL,
	[Deleted] [bit] NOT NULL,
	[PartsFamilyID] [int] NOT NULL,
	[PackageID] [int] NULL,
	[PinOutId] [int] NOT NULL,
	[GroupID] [bigint] NULL,
	[Equation] [varchar](500) NULL,
	[Masked_ID] [int] NULL,
	[CreatedDate] [datetime] NULL,
	[CreatedBy] [int] NULL,
	[ModifiedDate] [datetime] NULL,
	[Modifiedby] [int] NULL,
	[DeletedDate] [datetime] NULL,
	[DeletedBy] [int] NULL,
	[LatestCompanyID] [bigint] NOT NULL,
	[DateOfLatestCompanyID] [datetime] NULL,
 CONSTRAINT [PK_Nop_Part] PRIMARY KEY CLUSTERED 
(
	[PartID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [UC_Partnon_LatestCompanyID] UNIQUE NONCLUSTERED 
(
	[PartNumberNon] ASC,
	[LatestCompanyID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [uc_partnumbernonCompany] UNIQUE NONCLUSTERED 
(
	[PartNumberNon] ASC,
	[CompanyID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [Parts].[Nop_Part] ADD  CONSTRAINT [DF_Nop_Part_PinOutId]  DEFAULT ((0)) FOR [PinOutId]
GO

ALTER TABLE [Parts].[Nop_Part] ADD  DEFAULT (getdate()) FOR [DateOfLatestCompanyID]
GO

ALTER TABLE [Parts].[Nop_Part]  WITH NOCHECK ADD FOREIGN KEY([Masked_ID])
REFERENCES [dbo].[Core_Masked] ([ID])
GO

CREATE TABLE [Parts].[Nop_Part](
	[PartID] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
	[PartNumber] [nvarchar](70) NOT NULL,
	[PartNumberNon] [nvarchar](60) NOT NULL,
	[CompanyID] [int] NOT NULL,
	[Active] [bit] NOT NULL,
	[Deleted] [bit] NOT NULL,
	[PartsFamilyID] [int] NOT NULL,
	[PackageID] [int] NULL,
	[PinOutId] [int] NOT NULL,
	[GroupID] [bigint] NULL,
	[Equation] [varchar](500) NULL,
	[Masked_ID] [int] NULL,
	[CreatedDate] [datetime] NULL,
	[CreatedBy] [int] NULL,
	[ModifiedDate] [datetime] NULL,
	[Modifiedby] [int] NULL,
	[DeletedDate] [datetime] NULL,
	[DeletedBy] [int] NULL,
	[LatestCompanyID] [bigint] NOT NULL,
	[DateOfLatestCompanyID] [datetime] NULL,
 CONSTRAINT [PK_Nop_Part] PRIMARY KEY CLUSTERED 
(
	[PartID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [UC_Partnon_LatestCompanyID] UNIQUE NONCLUSTERED 
(
	[PartNumberNon] ASC,
	[LatestCompanyID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [uc_partnumbernonCompany] UNIQUE NONCLUSTERED 
(
	[PartNumberNon] ASC,
	[CompanyID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [Parts].[Nop_Part] ADD  CONSTRAINT [DF_Nop_Part_PinOutId]  DEFAULT ((0)) FOR [PinOutId]
GO

ALTER TABLE [Parts].[Nop_Part] ADD  DEFAULT (getdate()) FOR [DateOfLatestCompanyID]
GO

ALTER TABLE [Parts].[Nop_Part]  WITH NOCHECK ADD FOREIGN KEY([Masked_ID])
REFERENCES [dbo].[Core_Masked] ([ID])
GO

Impacts on SSIS if SQL Server Version is migrated

$
0
0

Hi,

I have a requirement in my project where we are planing to migrate SQL Server to a newer version but we have SSIS packages running on a different server which we do not want to migrate at the same time. 

Is it possible to migrate just the SQL server with out migrating SSIS services running on a different box?

Thanks!

Email Script Works on VS2015, But Not VS2017

$
0
0

Hello, all -

I have an email script that works fine and dandy on a box running VS2015. But, we will be losing those systems at some point and we have been given new laptops with VS2017 to use concurrently, until we lose the old laptops.

My email script is in VB.NET and leverages Outlook. It has two lines;

objDoc = OutMail.GetInspector.WordEditor
objBkm = objDoc.Bookmarks("_MailAutoSig")

that are used to grab the default signature and this works as it should on my box running VS2015. But, on the VS2017 version, when I hover the cursor over objDoc, the value shows as "Nothing."

My limited knowledge tells me that WordEditor is not working, for some reason, but I don't know why.

Might anyone be able to give me some assistance on what may be happening?

Thanx in advance for any help!

How to configure TFS to automatically build an ISPAC file on check-in

$
0
0

Hello Everybody,

We are checking our SSIS 2016 packages into TFS.  We always make sure we can successfully build the project, too, which creates the *.ispac file for us locally.  When it comes time to deployment, we manually pass that ISPAC over to the Operations group.  The Operations person then logs onto the production SSIS server and double-clicks the ISPAC file in order to bring up the SSIS deployment wizard. 

Sometimes this process doesn't work for us due to human error.  Typically, that's a developer forgetting to check in the project they built into an ISPAC.  That ISPAC gets deployed, but when the next developer makes changes to the same project, we reintroduce a bug that was fixed in the previous deployment.

Is there a way to force TFS to create the ISPAC for us?  In this way, we could ensure that what gets checked in is what gets deployed (and likewise what doesn't get checked in doesn't get deployed).

Thanks,
Eric B.

ssis packages are hang - azure sql running through adf pipelines

$
0
0

hi all,

i am running my ssis packages through azure data factory pipelines.

from last couple of days some of pipelines are queue in adf and they are doing nothing.

when i check package execution from integration catalog - ssisdb-- project-- package -- right click execution, sometimes it is saying running or sometimes it is showing cancel or unexpected but ultimately it is not doing anything.

how can i stop long running package as it is not doing anything.also does it create any deadlock or so because other pipelines are also get stuck.

please help for the same. 


convert ANSI to unicode

$
0
0

Hi,

I am trying to convert while uploading a text file from ANSI format text file  to Unicode format text file.
How can I do it in Classical ASP.

I mean by default the format of text file is ANSI. And when I select this file and trying to upload it in to server then I need to convert this text file format from ANSI to UNICODE.

Means once the file is uploaded from my local PC to sever then the uploaded file on the server must be in UNICODE format.

How can I do this one? Please help me!

Regards
Shaji



How to check 1st character of a file using SSIS VB script task?

$
0
0

Hi Everyone,

I have a fixed width file where we have 1 header row, N number of Detail rows and last row is the Trailer row. Header row starts with 'H', All detail rows starts with 'D' and trailer row starts with 'T' always. If all these rows starts with respective characters then only I need to do my operation else I need to ignore the file. How can we check this using SSIS VB script task?

Thanks in advance


Give search pattern dynamically from a variable

$
0
0

Hello 

I have this script below . i need to give the Search  pattern *.txt from a ssis variable  rather than a hardcoded *.txt . can you please  help 


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

namespace ST_dc1aa62cbc1e4136abe4da075f0e9c7d
{
    /// <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
{
        #region Help:  Using Integration Services variables and parameters in a script
        /* To use a variable in this script, first ensure that the variable has been added to 
         * either the list contained in the ReadOnlyVariables property or the list contained in 
         * the ReadWriteVariables property of this script task, according to whether or not your
         * code needs to write to the variable.  To add the variable, save this script, close this instance of
         * Visual Studio, and update the ReadOnlyVariables and 
         * ReadWriteVariables properties in the Script Transformation Editor window.
         * To use a parameter in this script, follow the same steps. Parameters are always read-only.
         * 
         * Example of reading from a variable:
         *  DateTime startTime = (DateTime) Dts.Variables["System::StartTime"].Value;
         * 
         * Example of writing to a variable:
         *  Dts.Variables["User::myStringVariable"].Value = "new value";
         * 
         * Example of reading from a package parameter:
         *  int batchId = (int) Dts.Variables["$Package::batchId"].Value;
         *  
         * Example of reading from a project parameter:
         *  int batchId = (int) Dts.Variables["$Project::batchId"].Value;
         * 
         * Example of reading from a sensitive project parameter:
         *  int batchId = (int) Dts.Variables["$Project::batchId"].GetSensitiveValue();
         * */

        #endregion

        #region Help:  Firing Integration Services events from a script
        /* This script task can fire events for logging purposes.
         * 
         * Example of firing an error event:
         *  Dts.Events.FireError(18, "Process Values", "Bad value", "", 0);
         * 
         * Example of firing an information event:
         *  Dts.Events.FireInformation(3, "Process Values", "Processing has started", "", 0, ref fireAgain)
         * 
         * Example of firing a warning event:
         *  Dts.Events.FireWarning(14, "Process Values", "No values received for input", "", 0);
         * */
        #endregion

        #region Help:  Using Integration Services connection managers in a script
        /* Some types of connection managers can be used in this script task.  See the topic 
         * "Working with Connection Managers Programatically" for details.
         * 
         * Example of using an ADO.Net connection manager:
         *  object rawConnection = Dts.Connections["Sales DB"].AcquireConnection(Dts.Transaction);
         *  SqlConnection myADONETConnection = (SqlConnection)rawConnection;
         *  //Use the connection in some code here, then release the connection
         *  Dts.Connections["Sales DB"].ReleaseConnection(rawConnection);
         *
         * Example of using a File connection manager
         *  object rawConnection = Dts.Connections["Prices.zip"].AcquireConnection(Dts.Transaction);
         *  string filePath = (string)rawConnection;
         *  //Use the connection in some code here, then release the connection
         *  Dts.Connections["Prices.zip"].ReleaseConnection(rawConnection);
         * */
        #endregion


/// <summary>
        /// This method is called when this script task executes in the control flow.
        /// Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
        /// To open Help, press F1.
        /// </summary>
public void Main()
{
            // TODO: Add your code here
            
            var directory = new DirectoryInfo(Dts.Variables["User::varSourceFolder"].Value.ToString());

            FileInfo[] files = directory.GetFiles("*.txt", 0);
            DateTime mostRecentFileDate = DateTime.MinValue;
            Dts.Variables["User::varMostRecentFileName"].Value = "";
            Dts.Variables["User::varMostRecentFileDate"].Value = "";
            String shortFileName = "";
            String shortFileDate = "";
            DateTime fileDate;
            DateTime batchDate;
            TimeSpan difference;

            foreach (FileInfo file in files)
            {
                shortFileName = Path.GetFileNameWithoutExtension(file.ToString());
                shortFileDate = shortFileName.Substring(shortFileName.Length - 8);
                fileDate = DateTime.ParseExact(shortFileDate, "yyyyMMdd", null);    //.ToString("yyyy-MM-dd");
                batchDate = DateTime.ParseExact(Dts.Variables["User::varBatchDate"].Value.ToString(), "yyyy-MM-dd", null);

                if (fileDate <= batchDate  && fileDate > mostRecentFileDate)
                {
                    mostRecentFileDate = fileDate;
                    difference = batchDate - mostRecentFileDate;
                    Dts.Variables["User::varMostRecentFileDate"].Value = mostRecentFileDate.ToString("yyyy-MM-dd");
                    Dts.Variables["User::varFileDateDifferenceInDays"].Value = difference.Days;
                    Dts.Variables["User::varMostRecentFileName"].Value = file.FullName.ToString();
                }
            }

            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

}
}

Nested IF ELSE in a derived column

$
0
0

I have the following logic to store the date in my BI_StartDate as below :

  • If UpdatedDate is not null then BI_StartDate=UpddatedDate
  • ELSE BI_StartDate takes EntryDate value , if the EntryDate is null then BI_StartDate=CreatedDate
  • If the CreatedDate IS NULL then BI_StartDate=GetDATE()

I am using a derived column like below :

ISNULL(UpdatedDateODS)? EntryDateODS :(ISNULL(EntryDateODS)? CreatedDateODS :(ISNULL(CreatedDateODS)? GETDATE()))

I am guetting this error :

The expression "ISNULL(UpdatedDateODS) ? EntryDateODS : (ISNULL(EntryDateODS) ? CreatedDateODS :(ISNULL(CreatedDateODS) ? GETDATE() ))" on "Derived Column.Outputs[Derived Column Output].Columns[Derived Column 1]" is not valid.

Can't Aquire connections because OfflineMode is true

$
0
0
I am designing a SSIS package (source=Flat files,, destination =OLEDB) which is executing fine on my system but when I try to execute it on Server 2003 (x64)
it says Error: The AcquireConenction method call to connection manager "name of conn" failed with error code 0xC0014019 and
it says can't Aquire Connections because OfflineMode is true, while as I checked several times while saving the package it is set to false...


Proxy account failing to run SSIS Error (Proxy (11) is not allowed for subsystem "SSIS" and user "AB\testuser ".Grant permission by calling sp_grant_proxy_to_subsystem or sp_grant_login_to_proxy. (.Net SqlClient Data Provider).)

$
0
0

Dear all,

I have Job and it is failing with below error always

Proxy (11) is not allowed for subsystem "SSIS" and user "AB\testuser ".Grant permission by calling sp_grant_proxy_to_subsystem or sp_grant_login_to_proxy. (.Net SqlClient Data Provider).


Below is the create script for Proxy account created.


USE [msdb]
GO


EXEC msdb.dbo.sp_add_proxy @proxy_name=N'Proxy_SIS_STG',@credential_name=N'Stg_user',@enabled=1
GO
EXEC msdb.dbo.sp_grant_proxy_to_subsystem @proxy_name=N'Proxy_SIS_STG', @subsystem_id=11
GO
EXEC msdb.dbo.sp_grant_login_to_proxy @proxy_name=N'Proxy_SIS_STG', @login_name=N'AB\testuser'
GO


Some body help me to find out where is the problem.


SNIVAS

Non-SysAdmins have been denied permission to run DTS Execution job steps without a proxy account.

$
0
0

I'm trying to run an SSIS project, but I can't get the ProxyAccount working.

I'm getting the following error:

Non-SysAdmins have been denied permission to run DTS Execution job steps without a proxy account.

I believe this is the key.

http://www.mssqltips.com/sqlservertip/2163/running-a-ssis-package-from-sql-server-agent-using-a-proxy-account/

That error message is exactly the same as the one I'm getting!  However, when I go through the steps in that link, I get an error on Step #2. 

Step #1 works fine.  I ran it EXACTLY as it appears in the link.  When I run Step 32, I get this.

Msg 14529, Level 16, State 1, Procedure sp_add_proxy, Line 45
Proxy "ARSHADALI-LAP\SSISProxyDemoUser" is not a valid Windows user.
Msg 14262, Level 16, State 1, Procedure sp_verify_proxy_identifiers, Line 51
The specified @proxy_name ('SSISProxyDemo') does not exist.

I don't understand what the error is, so I can't get past this step.  Any ideas how I can move forward on this anyone?  I've been working on this darn problem for a couple weeks now!!

Does anyone have any idea how I can get this working?

Thanks!!!


Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

Viewing all 24688 articles
Browse latest View live


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