Wednesday, December 9, 2009
Load MS Access data to SQL server
Answer:
There are 2 ways for achieving this
1) SSMS: Import & Export Wizard
2) BIDS: Create a New SSIS package
First approach is easy and gives you flexibility to modify the SSIS package(If required)
I hope you can try this your self .
Let me know if you need my help for this.
Second approach:
Open the BIDS and create a new package
Step1:
a) Create a new OLE DB Source connection.
b) Select the provider as "Native OLE DB\ Microsoft Jet 4.0 OLE DB Provider".
c) Select the Database file name. [Check the Image Below]
Step2:
a) Take a DFT.
b) In DFT drag "OLE DB Source", "OLE DB Destination" [or take any destination as per your requirement]
[Check the Image below]
Step3:
Before executing the package please makes sure that destination table should have the correct data type. [if not use data conversion task]
I hope this will help you. If you need more assistance or clarification, please leave the comment.
Monday, November 23, 2009
What is Factless Fact table?
Factless fact tables are used for tracking a process or collecting stats. They are called so because, the fact table does not have aggregatable numeric values or information. They are mere key values with reference to the dimensions from which the stats can be collected
Tuesday, October 6, 2009
Delete bunch of dynamic files
Answer: Please follow the following steps:
Step1: Add a For each loop container. & Inside it add a File system task.
Step2: Add 2 variables (Scope: Package level)
Step3; Double click on Foreach loop container and in expression map the "Directory" property to Var-InputFolder. (Click on the image for larger view)
Please select the "Reterive file name" property to fully qualified.
Step4; Map the Var_FilePath in variable mapping tab.
Step5: Double click on File system task and change the operation to "Delete file" and Set IsSourcePathVariable property to TRUE. Then map your Var_FilePath to it. (Click Image)
Step6: Now select the File System Task and press F4 for property window. Set the "Delay validation" to True.
Step7: Execute your package.
Hope this will help you.
:)
Allocating a 'Set ID' & Extracting data in groups
Question:
Allocate a Set ID for a Batch of data and make a group.
OR
Retain Values from Previous Rows.
Following is the input data and desired output for that
Answer:
Drag a DFT in the control flow and add the following components.For achieving this you need to use Script Component in DFT. and the following below steps: Before that you need to select Header as input column.
Create an output column in script component
Add the following code in the Script component.
'*******************************************************************************
Imports System
Imports System.Data
Imports Microsoft.SqlServer.Dts.Runtime
Public Class ScriptMain
Inherits UserComponent
Dim int_Sno as integer ' // this variable should be global for the script (class level)
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Try
If Row.RecType = "A" Then
int_Sno = int_Sno + 1
End If
Row.Sno = int_Sno
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
******************************************************************
Now execute your package and you will get the desired output (Given below)
Hope this will help you.
Friday, August 14, 2009
Excel destination - cannot convert between unicode and non-unicode
Error1 Validation error. Data Flow Task: Excel Destination [1311]: Column "Order Date" cannot convert between Unicode and non-Unicode string data types.
OLE DB source query:
where order_date data type is datetime in DB. Here we are converting to varchar
DFT (OLE DB Source and Excel destination)
Table structure:
I checked on MSDN for excel destination. Here is some content written about moving data for your reference: Data types. The Excel driver uses only six data types, which Integration Services maps as follows: · Numeric – double-precision float (DT_R8) · Currency – currency (DT_CY) · Boolean – Boolean (DT_BOOL) · Date/time – date (DT_DATE) · String – Unicode string, length 255 (DT_WSTR) · Memo – Unicode text stream (DT_NTEXT)
Integration Services does not implicitly convert data types. for resolving this problem please follow these steps.
Step1: Add Data Conversion task between Source and Excel destination
Monday, July 20, 2009
How to include Primary ID column using SSIS package?
I have target table where columns are ID, Name & DateofBirth where ID is PK and should be increment of 1(eg. 1, 2, 3, 4... and so on) also NOTE that ID column is NOT AN IDENTITY column
Now I have flat file which has data with only Names & Dateofbirth.
http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/db36004b-30a8-4404-8f95-301cc4a628f1
Answer:
Hi, There are two ways.
The Row Number Transformation calculates a row number for each row, and adds this as a new output column to the data flow. The column number is a sequential number, based on a seed value. Each row receives the next number in the sequence, based on the defined increment value.
Second:: Add a "Script Component transformation" and write a script there for adding the row numbers. Please check the "Row Numbers in a DataFlow"for step-by-step explanation.