How to migrate DTS Package into SSIS 2008 package

Posted by Ravi Khanal on Jan 10, 2009

If You are planning to migrate DTS Package of SQL Server 2000 to SQL Server 2008’s SSIS Package then first open the Sql Server Management Studio. Connect to the database engine and open the Migration Wizard as shown in the image.

 

Read the rest of this entry »


How to Synchronize Logins and manage Orphaned Users

Posted by Ravi Khanal on Dec 19, 2008

Database movement between servers is one of the common task for the DBA. But when the database is moved from one server to another or from one instance to other, the logins do not get transferred. So as a DBA you have to manually transfer the logins to remove this problem.

So let’s discuss what is the cause behind this. SQL Server logins are stored in the master database and they are mapped against individual databases. The Login informations on SQL Server 2005 are visible through sys.server_principals system catalog view and the sys.logins view. The mapping information of the database user is stored in the sysusers system table. This table includes the name of the database user and the SID of the corresponding SQL Server Login. The SID is the security identifier and SID tracks the logins throughout the entire systems.

So when we move or copy our database from one server to another or from one instance to another then the windows login will have the same SID but the SQL logins may have the different SIDs. So when the SID of the new server instance and the older instance doesn’t matches we have a Orphaned User.

Read the rest of this entry »


SSIS Package for merging data sources and applying transformations

Posted by Ravi Khanal on Dec 14, 2008

Scenario:
I have file in different heterogeneous sources like Text file and Excel File and I want to merge it into the SQL Server Table. But before loading the data into SQL Server table I have to change the First Name Column into Upper Case and also I need to give 20% raise in the salary. So I should have the proposed salary column added to the table.

Solution:

So First I need to have the data flow task for this.

Then in the data flow the package would be like this:

Read the rest of this entry »


Sample SSIS Package

Posted by Ravi Khanal on Dec 6, 2008

Scenario:

In the inbound location, I have to create a directory which would be like “DealerSales and Current Date” and then download files from the remote location to that directory. Then I have to move the files from there to the working directory. Then I have to unzip the zip files and load the text files to the database and delete the text files from the working directory and move the zip from the working directory to the Archive folder. The directory’s date format should be in MMDDYYYY format.

Solution:

There could be a different approach to make the SSIS Package. One of the easier way to make the Package for this type of scenario could be like this:

  1. Let’s first have the File System Task which will create a directory like “DealerSales12052008″ inside download directory, if it doesn’t exist.
  2. Then let’s have the FTP Task which will download files from remote location to that folder.
  3. Then let’s have the File System Task which will create a directory like “DealerSales12052008″ inside the working directory, if it doesn’t exist.
  4. Then let’s have the For Each Loop Container and File System task which will move files from download directory to the working directory.
  5. Then let’s have the For Each Loop Container and Execute Process Task which will unzip the Zip files.
  6. Then let’s have the For Each Loop Container and Data Flow Task which will load all the text files into the SQL Server database.
  7. Then let’s have the File System Task which will create a directory like “DealerSales12052008″ inside the Archive Directory.
  8. Then let’s have the For Each Loop Container and File System Task which will move the zip files to the Archive Directory.
  9. Then let’s have the For Each Loop Container and File System Task which will delete the text files from the working directory.
  10. Then let’s have a File System tasks which will clean up our download directory and working directory.

So now let’s begin by making the skeleton of the package by dragging the task and which would look like this:

Read the rest of this entry »