ssis

Check for either ADO.NET / OLEDB Connection presence and then insert to DB

Deadly 提交于 2020-01-06 07:46:22
问题 I originally posted the question to check for presence of either ADO.NET/OLEDB connection types. That being resolved, I'd like to know, how to change the code when it comes to inserting to the DB. For example, when the connection type is ADO.NET we use the "Transaction" in the connection type. SqlConnection connection = (SqlConnection)connections[_connectionName].AcquireConnection(transaction); Now if I have the OLEDB connection (instead of ADO.NET), I'd like to handle that situation in this

How to create a dynamic IN query in SSIS 2008?

回眸只為那壹抹淺笑 提交于 2020-01-06 07:16:14
问题 I have a variable @csv which hold a comma separated value such as: -a -a,b -a,b,c I need to pass it in a query in my OLE DB source in a data flow to create a query such as: SELECT COUNT(1) FROM table WHERE col1 IN @csv So if @csv="a,b" then internally it should resolve into SELECT COUNT(1) FROM table WHERE col1 IN 'a','b' How can this be best achieved in SSIS 2008? Can I avoid the script component to create a dynamic query and storing it in a variable? 回答1: How can this be best achieved in

How can I load in a pipe (|) delimited text file that has columns that sometimes contain line breaks?

落爺英雄遲暮 提交于 2020-01-06 06:24:27
问题 I have built an SSIS package that loads in several delimited text files into a SQL database. One of the files often contains line spaces in it, which breaks the standard data flow task of setting a flat file source and mapping to an ado.net destination since it thinks it is on a new line when it reaches a line break. The vendor sending over the files does not want to sent the file without any edits and can't do XML at this time. Is there any way to fix this? I was thinking of writing a small

SSIS File Filter in For Each File Enumerator

心已入冬 提交于 2020-01-06 06:11:08
问题 I have a For each file Enumerator. Under the folder I have E:\Input Under the Files I have "*" + @[User:Date] + "*.*" The date variable is set to 20180101 . The Variable Mappings are set to User::FileToBeMoved Within the Enumerator I have a File System Move File with the Source being the Variable User::FileToBeMoved and the destination being a variable containing E:\Input\Archive I have files in there like In20180101.txt , Intermediate20180101.txt and Out20180101.txt The files are not being

SSIS: Using rows from Flat file source and pass them as parameter values to stored procedure

青春壹個敷衍的年華 提交于 2020-01-06 06:10:11
问题 I have followed the steps mentioned in the below post but with no success. SSIS Execute a Stored Procedure with the parameters from .CSV file SQL Server 2005 I cant seem to map the flat file output columns to my stored procedure parameters, where is this done? Thanks Dave 回答1: It will be under Column Mappings on the OleDB Command task. 来源: https://stackoverflow.com/questions/5096490/ssis-using-rows-from-flat-file-source-and-pass-them-as-parameter-values-to-stor

unable to update the first cell in the excel worksheet using C# code in SSIS

女生的网名这么多〃 提交于 2020-01-06 04:57:26
问题 the following code was used in a execute script task of ssis package based on c# 2017 language used the following code which was taken from this answer Application excelApplication = new Excel.Application { Visible = true, ScreenUpdating = true }; string filename;//= Dts.Variables["User::filename"].Value.ToString(); filename = @"D:\Sundeep\2019\01082019\VersionWithDummyData\finbalReviewTest.xlsx"; _Workbook workbook = excelApplication.Workbooks.Open(filename); _Worksheet sheet = workbook

SSIS Package stays in execution and doesn't finish execution nor gives an error

丶灬走出姿态 提交于 2020-01-06 04:54:27
问题 I have created a package which has multiple data flow tasks. It also includes BEGIN TRANSACTION as an Execute SQL Task When package is called by another package, it doesn't finish execution. However, if it is run by hand, it executes successfully. Here is the screenshot of the package 来源: https://stackoverflow.com/questions/52268610/ssis-package-stays-in-execution-and-doesnt-finish-execution-nor-gives-an-error

SSIS Derived Column System Variable Length with expression

自作多情 提交于 2020-01-06 03:47:05
问题 I have a source column, KEY2 that I need to perform some string manipulation on within the Derived Column transformation within SSIS. It's configured as the following KEY2 Replace 'KEY2' (FINDSTRING(KEY,",",1) - 2) > 0 ? SUBSTRING(KEY,FINDSTRING(KEY,",",1) + 2,LEN(KEY) - FINDSTRING(KEY,",",1) - 1) : "" string [DT_STR] 1 1252 (ANSI - Latin I) The length is 1. I need to change it to 100. I have tried this: (DT_STR,100)(FINDSTRING(KEY,",",1) - 2) > 0 ? SUBSTRING(KEY,FINDSTRING(KEY,",",1) + 2,LEN

Add extra external column to flat file source

点点圈 提交于 2020-01-06 03:45:09
问题 I have a simple ssis package (2005) which reads a fixed width flat file source and dumps into a table. File so far had 5 columns, last column being 50 length. Now the format changed, a new column is added(length 4)at the end and previous 50 length column is only 10 length now. I figured it should be very simple, just go to advanced editor of the source under data flow, and under external columns, modify Column4 (my columns are named Column0 through 4) and change its length to 10, then 'add

Unable to send mail from SSIS using script task

删除回忆录丶 提交于 2020-01-05 17:18:08
问题 I have created script task in SSIS and wrote C# program to send mail. it is like this. public void Main() { MailMessage mail = new MailMessage("from@email.com", "to@gmail.com", "subject", "body"); SmtpClient client = new SmtpClient("smtp.office365.com", 587); client.Credentials = new NetworkCredential("from@email.com", "password!!!"); client.EnableSsl = true; client.Send(mail); Dts.TaskResult = (int)ScriptResults.Success; } When i tried to run the program, it shows the following exception.