Posts

Showing posts with the label excel

SSIS - Excel data source not taking more characters than 255

Image
Problem: I have developed SSIS package that import multiple excel files into SQL. Now issue is "Excel data source" check first few rows for determine datatype and it took text data type with length 255 for my remarks column. But in some files remarks is longer than 255 chars. I checked some blogs they saying intentional put long text in first row for remarks then SSIS will determine datatype as Unicode text stream. That solved my problem but when other file comes to import datatype again changed to 255 chars and getting truncation error. Please advise how to fix this issue. Solution: Inside the Data Flow Task, right click on the  Excel Source  component, got to  Advanced Editor  >>  Input and Output Properties  Tab, and change the column length manually in the External Columns and Output Columns as shown in the screenshot below. Original post:  https://stackoverflow.com/questions/57644766/in-ssis-excel-datasource-not-taking-...

SSIS - change excel columns number format from Script Task

Image
Problem: I am exporting Data from SQL Server, utilizing SSIS Data Flow Task. Here all columns appear as Text despite export formatting. Hence I need to develop a SSIS Script task to do the necessary conversion. I am facing trouble in developing the script. I have Tried different options available in the internet. but unsuccessfully. using System ; using System . Data ; using Microsoft . SqlServer . Dts . Runtime ; using System . Windows . Forms ; using System . Diagnostics ; using System . IO ; using System . Drawing ; using System . Runtime . InteropServices ; using Excel = Microsoft . Office . Interop . Excel ; namespace ST_de899f405b7b4083b0ad8cba6b3df2e3 { [ Microsoft . SqlServer . Dts . Tasks . ScriptTask . SSISScriptTaskEntryPointAttribute ] public partial class ScriptMain : Microsoft . SqlServer . Dts . Tasks . ScriptTask . VSTARTScriptObjectModelBase { public void Main () { string inputFile = ( string ) Dts . Variables [ "Ta...