Create table for each flat file and load data
Senario:This Code can be used to load multiple files in multiple tables, each file will be loaded into separate table. The table will be created by reading the first line(Hearder row) of flat file and...
View ArticlePurge old Files
Scenario:You want to create a package that will read the folder Path,FileType,FileNameLike and Retention Period from Some Table and Then loop through each Folder path and delete required files those...
View ArticleLoad Files information to SQL Server Table
Scenario: Let's say we want to load the files information from folder to SQL Server Table.We want to load the File Name, File created datetime and File size in KiloBytes.Solution:Lets start by creating...
View ArticlePassing Parameter/Parameters values to Sub Query in Execute SQL Task
Scenario:We want to execute SQL Query in Execute SQL Task but before we do that we need to passparameter/parameters values to Inner Query or Sub Query.Solution: Lets say here is the query we want to...
View ArticleCreate flat file dynamically
Scenario:We have requirement to create a package that can create output file dynamically from View/Table.The columns of View/Table can change anytime but we don't want to open package and remap...
View ArticleMonthName and Day Name in SSIS
Scenario:Some time we have requirement to send email with MonthName or dayName in the subject,Create folder with Month Name and then Archive files e.g. Archive_Dec_2011.Solution:We don't have MonthName...
View ArticleRemove Leading,Trailing OR Both Zeros in SSIS
Scenario:Sometimes we get the data from flat file and we want to remove Leading Zero, Trailing Zeros OR Leading and Trailing both before insert into destination.Solution:I assumed that data we are...
View ArticleWrite Expression on Data Flow Task(Derived Column Transformation)
Scenario: We are developing a package and writing business logic by using Derived Column Transformation in Data Flow Transformation.This business logic is subjected to change.We don't want to open the...
View ArticleProject Versioning (Project Deployment SSIS) Denali
Project Versioning in Denali:Was exploring Denali CTP1, Now we can deploy Project to SSISDB Catalog.Each time we will deploy the project to SSISDB , the project will be saved as new version.We can see...
View ArticleAdding Update Columns dynamically
Here are the steps for the package1--Create definition table for your Update Queries--Create a definition table and insert some values, it will have SourceTableName, DestnationTable name, --Columns...
View ArticleExecute .SQL files by using SSIS
Problem:Sometime we have requirement to execute .sql files in SSIS. Let's assume that we have some .sql files in one folder those contain different DDL Statements, DML( update, delete) statements.We...
View ArticleRemove Special Characters from String and Convert to Multiple Columns by...
Problem:Sometime we get the data in one column with some kind of delimiter( such as comma,pipe, space etc) and also this string contains some special characters such as (.,./,$,#,@ etc).The current...
View ArticleEstimate the Size of a Heap
The script below can be used to estimate the size of tables in SQL Server Database with number of rows we want to estimate./*----------------------------------------1:Build the List of Tables with Rows...
View ArticleEnable Change Data Capture(CDC) on Database
/*--------------------------------1: Enable CDC ON Database----------------------------------*/DECLARE @DBName NVARCHAR(100)DECLARE @Cdc_Status BITSET @DBName='TESTDB' --> Provide your Database Name...
View ArticleDisable Change Data Capture(CDC) On Database
/*--------------------------------1: Disable CDC ON Database----------------------------------*/DECLARE @DBName NVARCHAR(100)DECLARE @Cdc_Status BITSET @DBName='TESTDB' --> Provide your Database...
View ArticleEnable CDC on Set of Tables OR Enable on All Tables in Database
/*------------------------------------------------Enable CDC on Set of Tables( To Enable CDC on Table , CDC Should be enabled on Database...
View ArticleDisable CDC On Set Of Tables OR Disable On All Tables In Database
/*------------------------------------------------Disable CDC on Set of Tables--------------------------------------------------*/DECLARE @TableName VARCHAR(100)DECLARE CDC_Cursor CURSOR FOR--Provide...
View ArticleModify Change Data Capture (CDC) Retention Period
/*---------------------------------------Change CDC Retention PeriodThe retention is provide in minutes , If we are providing in Days then we have to convert that to...
View ArticleEnable CDC On Entire Table OR Enable CDC On Table With List Of Columns
USE [DatabaseName]GO/*-----------------------------------------------------------------------------------------------------Sometime we have requirment to Enable CDC on Table including all the columns...
View ArticleCreate History OR Audit Views from Change Data Capture ( CDC) Tables
/*-----------------------------------------------------------------------------------After enabling CDC we want to Create AUDIT OR HIST Viewsso we can get the changed records. The below script...
View Article