RE: Duplicate name error after copying task/ VS_ISCORRUPT



to use the code in the sample listed you may need to add references to the
SQL dlls.

a-ha! What you have to do is copy the assemblies that you want to reference
into a special little folder. e.g. everything from
C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies

into

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies

once you have done this, go to 'add reference' in the macro soln explorer
(might need to right click on it) and selec the ...sql.runtime one (i think)
the at the top of the code put imports microsoft ah sod it, ill pinch the
example from that guy's page

Imports Microsoft.SqlServer.Dts.Runtime

Public Module RecordingModule

Public Sub ResetsEachExecutablesGuid()

Dim oApp As New Application, aszTaskID(0) As String
Dim oExec As Executable
Dim taskHost As TaskHost
Dim gdNewGuid As Guid, SSISObject As System.Object

Try
' Get package path
Dim oPackage As Package =
oApp.LoadPackage(DTE.ActiveDocument.FullName, Nothing)

' Loop through tasks
For Each oExec In oPackage.Executables
SSISObject = oExec
If oExec.GetType.Name.ToLower <> "taskhost" Then
Call LoopThroughContainer(SSISObject, aszTaskID)
End If

' Capture Task IDs
aszTaskID(aszTaskID.GetUpperBound(0)) = SSISObject.ID
ReDim Preserve aszTaskID(aszTaskID.GetUpperBound(0) + 1)
Next

' Edit package XML
DTE.ExecuteCommand("View.ViewCode")

' Loop through task ids captured
For i As Integer = 0 To aszTaskID.GetUpperBound(0) - 1

DTE.Find.FindWhat = aszTaskID(i).ToString
DTE.Find.ReplaceWith = "{" &
System.Guid.NewGuid.ToString.ToUpper & "}"

' Set find criteria
DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = True
DTE.Find.MatchInHiddenText = False
DTE.Find.Action = vsFindAction.vsFindActionReplaceAll

If (DTE.Find.Execute() = vsFindResult.vsFindResultNotFound)
Then
MsgBox("No values were found")
End If
Next

DTE.ActiveWindow.Close(vsSaveChanges.vsSaveChangesNo)
DTE.ActiveDocument.Save()
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try

End Sub

Private Function LoopThroughContainer(ByVal oContainer As System.Object,
ByVal aszTaskID() As String)

Dim oExec As Executable, SSISObject As System.Object

For Each oExec In oContainer.Executables
SSISObject = oExec
If SSISObject.GetType.Name.ToLower <> "taskhost" Then
Call LoopThroughContainer(SSISObject, aszTaskID)
End If

' Capture Task IDs
aszTaskID(aszTaskID.GetUpperBound(0)) = SSISObject.ID
ReDim Preserve aszTaskID(aszTaskID.GetUpperBound(0) + 1)
Next

End Function


End Module



"adolf garlic" wrote:

This looks like it could be the solution:
http://colinkirkby.blogspot.com/2006/12/ssis-macros-part-1.html


My only problem is I don't know what the SSIS object is in the code.
Also I do not seem to be able to reference "Microsoft.SQLServer" namespace.
It does not show up in the "add new reference" dialog

Anyone know a way around this?




"adolf garlic" wrote:

After copying a task from another package, I am getting a validation error
regarding a 'derived column' data flow component.

The error is as follows

Error 2 Validation error. Underlying updates: DTS.Pipeline: The package
contains two objects with the duplicate name of "output column
"UnderlyingName" (508)" and "input column "UnderlyingName"
(491)". Package2.dtsx 0 0

If I try and execute the task I get a dialog with the following error:
TITLE: Package Validation Error
------------------------------

Package Validation Error

------------------------------
ADDITIONAL INFORMATION:

Error at Underlying updates [DTS.Pipeline]: The package contains two objects
with the duplicate name of "output column "UnderlyingName" (508)" and "input
column "UnderlyingName" (491)".

Error at Underlying updates [DTS.Pipeline]: "component "Derived Columns 1"
(489)" failed validation and returned validation status "VS_ISCORRUPT".

Error at Underlying updates [DTS.Pipeline]: One or more component failed
validation.

Error at Underlying updates: There were errors during task validation.

(Microsoft.DataTransformationServices.VsIntegration)


Looking at BOL it tells you to click on 'reset' in the advanced editor (when
search ing on VS_ISCORRUPT) however there is no reset button and hitting the
'refresh' button instead has no effect.


How can I fix this problem?

The guys who QA'd the copy and paste functionality should be fired,
preferrably from a giant cannon.

So what if the component has columns with the same name as another task,
surely it would be bad practice and misleading to keep renaming columns as
the package proceeds, until by the end a column which started out as halibut
turns into one called felchmonkey...? Or maybe I am just mad.
.