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

Memory management in script task ?

$
0
0

I have no choice but to load multiple result sets into memory via script task. Then, I will use the script task to read each of these results and combine the relevant columns (as per rules) into a txt file. There is no certainty on how big the data set will be or how many tables will have to be handled. My ETL will simply see which tables to get data from and then store them in memory for processing.

The worst case could be that I run out of memory. So, is there a simple way I can page a resultset to the harddisk and extract it in parts ? Is there a better way to do what I am trying ?

Thanks.


emptying a folder using SSIS script task

$
0
0

Hi Guys,

I am generating reports to a directory (folder), via ssis script task and C#.. I want to validate the following..

1. Deleting all old reports except last 10 reports. My report name for example is Report_DDMMYYYY

2. If current report already exists then I want to overwrite that report every time if i run the ssis script task (which exists in a foreach loop container) manually.

I am using Streamwriter to dump the data into a flatfile report.

Thanks.

 

SSIS-Execute Process task Error _File/Process "\\Servername\Foldername\batfile.bat" is not in path

$
0
0

Hi Sir,

I have designed the SSIS Package in 2012 Version. and i have deployed into the Integration Server,using Project Deployment Model.

In the SSIS Pacakge we are calling the batch file using Execute Process task.

when i am Executing the SSIS pacakge using Visual Studio(Sql Server Data tools) which is working fine.

When i Execute the Pacakge uisng Sql server Management Studio,after the Deployment i am getting the below Error message.

ExecProcess task:Error: File/Process "\\Servername\Foldername\batfile.bat" is not in path.

Thanks for your time.

Regards

Prasad




HI plese Help me out - get filename from filepath

$
0
0

Hi

 C:\users\satish\desktop\inflow\documentation.txt

I have a requirement to get file names like

documentation


satish reddy


ETL Master SQL job got a “Login Time Out “ error again

$
0
0

Below error coming randomly Sometimes it works perfectly fine and sometimes it goes down with following error message. The connectivity between two servers are seamless there is not a single drop of packet.

Please suggest what is wrong happening here. One server is on Windows 2003 x64 and another is on Windows 2008 R 2.

Executed as user: xyz\user1. Microsoft (R) SQL Server Execute Package Utility  Version 11.0.3393.0 for 64-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  12:00:07 AM  Error: 2013-12-27 01:01:57.58     Code: 0xC0202009     Source:DailySync_I Connection manager "OLE_SRC2_"     Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.  An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80004005  Description:"Login timeout expired".  An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80004005  Description: "Unable to complete login process due to delay in login response".  An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80004005  Description: "TCP Provider: Timeout error [258]. ".  End Error  Error: 2013-12-27 01:01:58.58     Code: 0xC020801C     Source: Load Lookup Tables OLE DB Source [699]     Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "OLE_SRC2_" failed with error code 0xC0202009.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.  End Error  Error: 2013-12-27 01:01:59.67     Code: 0xC0047017     Source: Load Lookup Tables SSIS.Pipeline     Description: OLE DB Source failed validation and returned error code 0xC020801C.  End Error  Error: 2013-12-27 01:02:00.81     Code: 0xC004700C     Source: Load Lookup Tables SSIS.Pipeline     Description: One or more component failed validation.  End Error  Error: 2013-12-27 01:02:01.95     Code: 0xC0024107     Source: Load Lookup Tables      Description: There were errors during task validation.  End Error  DTExec: The package execution returned DTSER_FAILURE (1).  Started:  12:00:07 AM  Finished: 1:20:13 AM  Elapsed:  4805.61 seconds.  The package execution failed.

How to Loop Files based on Date Modified using Foreach loop Container in ssis.

$
0
0

Hi.

I want to loop through files based on Modified Date. Please let me know how to achive this.

If we want to use script then please provide me the Script.

HOW TO GIVE A DELIMITER IN SSIS PACKAGE AS 'TAB@'

$
0
0

Hi 

 I have requirement where , need to fetch records from a table and populate it in a flatfile.

But the delimiter to be used is TAB@ , when I give like this its showing records like given below

1TAB@VinnyTAB@ArizonaTAB@.........

Its literally writing TAB in there along with the tab character instead of just giving the tab character and @ follwowed by it.

How can I remove this and just make it look like

1@VInny @Arizona@ ..........

If I try using equivalent number of spaces for tab its working , bit problems is when we import it to excel , as the space and tab character delimiter is different.

Pleas provide a solutuion.

Thank you...

Praveen...

How to handle Null Contraints and how to redirect error rows from Flat file source task,Derived column task,OLEDB Destination too flat file destination and how to get exact error descrption from mentioned data flow task's?

$
0
0

Hi Experts,

Please help me to resolve the below mentioned issues,

(i)I had created NOT NULL table level contraints.

(ii)In SSIS data flow task i have Flat File Source,Derived column and OLE DB Destination(Inserting data into SQL Server table).

(iii)My requirement is i want to redirect error rows to flat file destination from all the above three mentioned task's with exact error descrption(Like we if we try to insert NULL OR '' then we should get error saying "Column doesnot allow nulls" and for primary key voilation also).

(iv)As of now in my SSIS package when i am trying to insert "" empty value to a NOT NULL column i am not getting any error like "column doesnot allow nulls".

(v) and i am not able to get the error description with error rows.

(vi) When i am trying to redirect error rows from OLEDB Destination,it's removing the error data in the row

As i couldn't find exact solution for this issue in this forum kindly help me..

Many thanks,

Asma



use destination table values in source to get data

$
0
0

I have a requirement to get data from source table to destination table. Source is oracle say tablename - 'orasource' fielnames=empid, empname and destination table name is 'sqldest' and field name are empid, empname.

My requirement - I want to fetch only those rows from source based on destination table 'sqldest' and field name is empid. How do I do this?


Adding a new Column in derived transformation using C#

$
0
0

hi all,

i am creating a ssis package using C#

i have created a dataflow task using .

i have also added a derived column .

how can i add a new column irrespective of the input columns .

my code:-

Executable e1 = package.Executables.Add("STOCK:PipelineTask");

               

TaskHost thMainPipe = e1asTaskHost;

               

MainPipe dataFlowTask = thMainPipe.InnerObjectasMainPipe;

              

               

// Add the OleDB Source Component 


               

IDTSComponentMetaData100 Source = dataFlowTask.ComponentMetaDataCollection.New();

                Source.ComponentClassID =

"DTSAdapter.OleDbSource";

                Source.ValidateExternalMetadata =

true;

               

// Get the Design Time of the Source OleDB 


               

CManagedComponentWrapper SourceDesignTime = Source.Instantiate();

                SourceDesignTime.ProvideComponentProperties();

                Source.RuntimeConnectionCollection[0].ConnectionManager =

                                                

DtsConvert.GetExtendedInterface(srcConnection);

                Source.RuntimeConnectionCollection[0].ConnectionManagerID =

                                       srcConnection.ID;

                Source.Name =

"OLEDBSource";

               

// Set the Access Mode and SQL Command to the OleDB Source


                SourceDesignTime.SetComponentProperty(

"AccessMode", 0);

                SourceDesignTime.SetComponentProperty(

"OpenRowset", tableName);

               

if (SourceDesignTime.Validate() ==DTSValidationStatus.VS_NEEDSNEWMETADATA)

                {

                    SourceDesignTime.ReinitializeMetaData();

                }

                SourceDesignTime.AcquireConnections(

null);

                SourceDesignTime.ReinitializeMetaData();

                SourceDesignTime.ReleaseConnections();

               

                   

//Derived Column


               

IDTSComponentMetaData100 derivedColumn = dataFlowTask.ComponentMetaDataCollection.New();

                derivedColumn.ComponentClassID =

"DTSTransform.DerivedColumn";

               

               

CManagedComponentWrapper derivedColumnDesign = derivedColumn.Instantiate();

                derivedColumnDesign.ProvideComponentProperties();

               

if (derivedColumnDesign.Validate() ==DTSValidationStatus.VS_NEEDSNEWMETADATA)

                {

                    derivedColumnDesign.ReinitializeMetaData();

                }

                dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications(Source.OutputCollection[0],

                derivedColumn.InputCollection[0]);

               

IDTSInput100 input = derivedColumn.InputCollection[0];

               

IDTSVirtualInput100 derivedInputVirtual = input.GetVirtualInput();

               

IDTSCustomProperty100 property =null;

               

foreach (IDTSVirtualInputColumn100 vColumn in derivedInputVirtual.VirtualInputColumnCollection)

                {

                    derivedColumnDesign.SetUsageType(input.ID, derivedInputVirtual, vColumn.LineageID,

DTSUsageType.UT_READWRITE);

                }

.....here now i need to add a new column whioch has no realtion to the input ...

such as (DT_STR,12,1252)("vivek")

please help

               

                   

               

How to run automatically VBscript-Macrocode on Excel sheet by using SSIS ?

$
0
0

Hi,

Source-Excel(.xlsx)

Destination - OLEDB destination(SQL server)

1.

Source-Excel sheet-Columns had some data type issues So I have to format the columns by using  RUN MACRO:Code on Excel sheet.It is a manual operation

2.

Latter  next step I am using Data flow(excel-OLEDB)

Here my problem is avoid the manual-Macro (format excel) work

How is it possible by using SSIS ?

Thanks

-Madhu

SSIS, empty numeric columns populated with previous numeric column value

$
0
0

I use MS Visual studio  2008.

I have a text file with more than one table's data in it (different column counts). I import the whole row as one column. Based on a conditional split, the rows are dispersed to their correct flow. I use a script component to split the single column values (row) into the correct columns for that table and give it as output columns. All of this is working fine, and data looks fine.

My problem comes in with some numeric fields. When a numeric field has no values in it, it ends up in the table with another column's numeric value.

I have put data viewers everywhere, in not one of them there is data for the column that should be empty. When I look in the table itself, there it is... data from another column.

  • It is not the mappings, I checked it a dozen times.
  • It is not the names that are the same or something like that.
  • There is no data according to dataviewers anywhere in the load process.
  • There is no hidden code anywhere.
  • I droped and recreated the table.
  • I displayed a messagebox with the column's (that is supposed to be empty) assigned "column value", and no data, like expected.
  • I used a derived column, same result, no data in dataviewers, but eventualy data in the table.

I also created another test table with those numeric fields as varchar. When I do this, the column is empty (like expected). When I change it to numeric, the field is populated again. (If it was the other way around I could understand).

What can be te reason for this? It is driving me insane.



Turn on Ignore Symbols in Fuzzy Lookup but get failed validation

$
0
0

Hi! I try to test fuzzy lookup with "Ignore Symbols" turned on but always get below messages.

If I uncheck the "Ignore Symbols", SSIS works fine.

Only one topic related is found on forum  Received an error while upgrading from SSIS 2005 to SSIS 2008 R2  but seems not helpful to me.

Is there any other settings need to be done before using "Ignore Symbols" ? 

My environment :

MS SQL 2012 + Win 7 , Run64BitRuntime = False , SRC_NAME and REF_NAME are both varchar . 


TITLE: Package Validation Error
------------------------------

Package Validation Error

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

Error at Data Flow Task 1 [Fuzzy Lookup [2]]: The value for custom property "FuzzyComparisonFlags" on Fuzzy Lookup.Inputs[Fuzzy Lookup Input].Columns[SRC_NAME] is incorrect.

Error at Data Flow Task 1 [SSIS.Pipeline]: "Fuzzy Lookup" failed validation and returned validation status "VS_ISBROKEN".

Error at Data Flow Task 1 [SSIS.Pipeline]: One or more component failed validation.

Error at Data Flow Task 1: There were errors during task validation.

 (Microsoft.DataTransformationServices.VsIntegration)

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

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

SSIS package does nothing when run from SQL Agent scheduled job

$
0
0
I have created an SSIS package in BIDS 2008 which imports data from 4 different sources (3 SQL Server databases and 1 Sybase database) into a SQL database 2008 R2 for consolidation.

OLE DB provider for Sybase : SQL Anywhere OLE DB  Provider 12.

32-bit ODBC System DSN for each Sybase database is created which works fine when tested and same is referenced in SSIS OLE DB connection managers.

SSIS package is saved on SQL Server via "Save Copy of Package.dtsx As..." with Protection level "Rely on server storage and roles for access control".

When the package is executed from BIDS, data is imported without any errors, but when same package is scheduled to run under SQL Agent, it either fails or does nothing.

If I disable the Sybase control flow from BIDS and redeploy on SQL Server and execute via agent job, it runs fine.

To check the failure when Sybase control flow is there, I have added step to send email notification on package failure with description. Here are the descriptions in from each email:

Message 1: Error code: -1073450996

Error description: One or more component failed validation.

Message 2: Error code: -1073594105

Error description: There were errors during task validation.

Message 3: Error description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "Sybase.cmfDb" failed with error code 0xC0202009.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.

Message 4: Error code: -1073450985

Error description: component "Data Source" (16) failed validation and returned error code 0xC020801C.

Job history message: Executed as user: DOMAIN\Username. The step failed.

Delay Validation is set to True for all data sources.

I already tried the solution from Experts Exchange, but it did not work: http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/Q_27636713.html

Keeping everything same in both BIDS and SQL storage, it works for BIDS and not from agent job. What could be wrong?

Thanks in advance.

Settiing SSIS Variables that are EvaluateAsExpression (to use as OLEDB Data Flow source) in 2008r2

$
0
0

Hi all,

This example is a mass simplifaction of what is actually a large query, but in essence I am unsure whether I am trying to do something too complicated for SSIS 2008R2.

I have an expression that I store in a variable, for example called varTest I also have another variable called varMonth, which is set to value 201310

On the varTest variable, I set the evaluateasexpression property to True and then set the value to:

"SELECT " +(DT_WSTR,6)@[User::Month] +" as month"

This correctly evaulates the expression as:

SELECT 201310 as month

I then use varTest as a SQL Command From Variable within a OLEDB data source, which works nicely.

However the problem exists when I want to set the varTest variable rather than use the value I manually type into Variable Window Pane with the package.

SSIS only seems to use the manually typed (current) varTest value and will not allow me to overwrite/set varTest with a new value, e.g.

"SELECT " +(DT_WSTR,6)(@[User::Month]+1) +" as month"

I have tried setting varTest in C# code within a Script Task or loading varTest as a ResultSet single row output from a SQL statement in SQL Task . The step always completes (green) but fails to set this variable.

Ideally I want to do this so I can store the whole query within a database table. Has anyone seeen this problem before?


how to import csv file with multiple tables into sql server

$
0
0

I have multiple csv files that has one sheet but has 130 headers with each header having different data. 

I'd like to import each one of these header rows with data into its own file in sql server. 

I know very basic SSIS and am but am not familiar with the scripting in it though which what I assume I'd have to use. 

Each header in the csv file is structured as such(also see example pic):

first header would be this:                                                                                                                      
      ITEM = ORG_V                                              
      DATE = 2013-07-22 10:00 ~ 2013-07-22 10:15      
column names
data

second header would be this:

ITEM = TER_V
      DATE = 2013-07-22 10:00 ~ 2013-07-22 10:15
column names
data


The headers can be at any random row number as well as the data size in each excel file differs but they all start with "ITEM =" and then in the next row "DATE ="

I could also convert these to excel files if it makes this process easier. 

trouble passing variable into package

$
0
0

I am having an issue reading a variable in a script task that I'm passing in from a windows service. I should be able to pass the param in from .NET and load it into one of my package vars right? The windows service is a file watcher service.

Windows Service code

                    Package pkg;
                    Application app;
                    DTSExecResult pkgResults;
                    Variables vars;

                    app = new Application();
                    pkg = app.LoadPackage(pkgLocation, null);d because I log it to a log file.

                    vars = pkg.Variables;

                    vars["User::FileName"].Value = sFileName.ToString();
                    pkgResults = pkg.Execute(null, vars, null, null, null);

The sFileName variable in the service is populated because I write it to a log file.

In the package I list the FileName variable as read/write. Have checked the spelling.

package code snippet:

      public void Main()
      {
      //get file and path info
      string sFileName = Dts.Variables["User::FileName"].Value.ToString();

the package fires but the variable is empty and I log an exception to the sysssislog:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.  Parameter name: length     at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)     at ST_5a4733488a6149abb109d633296e2c38.csproj.ScriptMain.Main()     --- End of inner exception stack trace ---     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()

I cannot find what the issue is. In the package I log to a text file the value of FileName variable and as expected it is empty.

I appreciate your help wit

       

     

Complex task using PIVOT Transformation

$
0
0

Hi All,

I'm having a peculiar situation where i think i have to use the PIVOT Transformation but there are some restrictions. Please see the below sample data set.

B1_PER_ID1	B1_PER_ID2	B1_PER_ID3	COLUMN_NAME	ATTRIBUTE_VALUE
13ZON	0	29	Disposition	Approved
13ZON	0	29	Disposition	Approved
13ZON	0	29	Disposition	Cont.
13ZON	0	29	Hearing	CCC
13ZON	0	29	Hearing	MDC
13ZON	0	29	Hearing	MDC
13ZON	0	29	Hearing Date	10/16/2013
13ZON	0	29	Hearing Date	11/20/2013
13ZON	0	29	Hearing Date	12/9/2013

I'm trying to use the PIVOT operator on the COLUMN_NAME field , but i'm getting the duplicate key error and i know the values should be unique, if i use the sort i dont get all the fields. I want the destination table to have dataset as follows

B1_PER_ID1	B1_PER_ID2	B1_PER_ID3	Disposition	Hearing	Hearing Date
13ZON	0	29	Approved	CCC	10/16/2013
13ZON	0	29	Approved	MDC	11/20/2013
13ZON	0	29	Cont.	MDC	12/9/2013

Please need suggestions on this. Thanks

SSIS package exclusive lock on source table

$
0
0

I have created a package that copies data from one table to another table on a different server. When I run the package, most of the time it runs for a while and then hangs.  I am using the method found in this website: http://blogs.msdn.com/b/jorgepc/archive/2010/12/07/synchronize-two-tables-using-sql-server-integration-services-ssis-part-i-of-ii.aspx for synchronizing the tables.  In BIDS as I am watching the execution of the package all objects turn Yellow in the Data Flow window and the counts do increase till it hangs.  Then the counts stop.

I have run the SQL Server "Resource Locking Statistics by Objects" report on the source server/database and it reports there are two locks on that table by my userid at the time I am running the package (a page lock and a object lock).  All I am doing with the table is reading it.  In the package the OLE BD Source(SQL Server Native Client 10.0) I am using a query "select * from table where id between ? and ?".  "id" is an identity column and a clustered index.

This package does work once in a while.  There was never any problems in the Development environment.  This is occurring in Production where another application is writing data to the table all day long.  The Development environment did not have another app running at the same time.

The package also copies 6 other tables with no problem.  The problem table is larger (more columns) than the other tables.

Any ideas of what the problem might be?

Fred


Fred Schmid



Send Email - Sending HTML format

$
0
0

Hi,

I have a variable string "varhtml" (contains an HTML codes) in Send Email task's Message Source.

However, when this is sent in the email, it is in plain HTML text and not formatted as i wanted it.

How can the body be formatted in HTML properly when sent to the email? 

Side note: this variable is being populated by the HTML codes generated in the Script Component


Thanks!



cherriesh

Viewing all 24688 articles
Browse latest View live


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