August 14, 2008 at 7:29 pm
I need to export into multiple flat file (naming convetion 'Original_FileName_' + File _1,2,3....) from a single table. The spile need to be based on file size or max 10,000 records in it. Anyone know any article on this would be great or any help is also fine. Thanks
August 15, 2008 at 2:06 am
You could use rownumbering and a conditional split. 0-10000, go here, 100001-200000 go there etc. Not very flexable though.
I would rather use a script component as a destination and manually write the file based on whatever condition.
Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!
August 17, 2008 at 4:58 pm
Do you know of any code sample link or article related to this please? Thanks
August 17, 2008 at 8:18 pm
Hi,
Here I am using Script component to export into multiple flat files. Once row reaches 10000 rows, I need to change connection string so that I can point to different flat file. Is anyone can help as how to change the connection string please? Thanks
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Public Class ScriptMain
Inherits UserComponent
Dim iCounter As Integer
Public Sub New()
'Initialise the counter
iCounter = 0
End Sub
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
'Increment the counter
iCounter += 1
If iCounter < 10000 Then
Row.vcPhone = Row.Phone1
Else
' Change Connection String
End If
End Sub
End Class
August 18, 2008 at 1:44 am
Look at dts.connections(n)
You select your connection and change it's values.
Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!
August 18, 2008 at 4:58 pm
I am using SCRIPT Component. When I enter DTS MS Visual studio do not populate with the properties for dts. Do I need to import other than I have already mentioned above? Thanks
August 19, 2008 at 1:21 am
Sorry, is slightly different for components.
You should do it nin the preexecute of the component.
Public Overrides Sub PreExecute()
Dim oCons As IDTSConnections90
If Not oCons.Contains("MyConn") Then Throw New Exception("Connection does not exist")
oCons("MyConn").ConnectionString = ""
oCons("MyConn").AcquireConnection(Nothing)
MyBase.PreExecute()
End Sub
Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply