![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm using the following transformation script to import data from Excel: One excel row has to be splitted into 5 records. The field ID is my primary key. How can I persuade SQL Server to automaticly set the primary key values ? Unchecking "enable identity insert" does not help. '************************************************* ********************* ' Visual Basic Transformation Script ' Copy each source column to the ' destination column '************************************************* *********************** Dim nRows nRows = 5 Int myNextID Function Main() myNextID = DTSLookups("GetNextID").Execute(0) myNextID = cInt(myNextID) + 1 DTSDestination("ID") = myNextID if nRows > 0 then Main = DTSTransformStat_SkipFetch DTSDestination("R_State") = 1 DTSDestination("R_AccountType") = 0 DTSDestination("DateCreated") = now Select Case nRows Case 1 DTSDestination("Account_No") = DTSSource("144#963#1/03") Case 2 DTSDestination("Account_No") = DTSSource("144#963#2/01") Case 3 DTSDestination("Account_No") = DTSSource("144#963#3/10") Case 4 DTSDestination("Account_No") = DTSSource("144#963#4/08") Case 5 DTSDestination("Account_No") = DTSSource("144#963#5/06") End Select nRows = nRows - 1 else nRows = 5 Main = DTSTransformStat_SkipInsert end if End Function thanks for any help mopetta |
![]() |
| Thread Tools | |
| Display Modes | |
| |