Very short blog post this one.
A guy on the SSIS Forum recently wanted to add a new GUID into the pipeline and was pertubed that there was no equivalent of T-SQL's NEWID() function in the SSIS Expression Language with which to do it. I agree that there SHOULD be a function to do it and I hope that one will one day appear.
In the meantime, we have to resort to a trusty old script component to help us out. Assuming a column called GUID of type DT_GUID exists in the pipeline then the following code will do what is required:
Imports System
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Public Class ScriptMain
Inherits UserComponent
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Row.GUID = System.Guid.NewGuid
End Sub
End Class
Hope that helps!
Told you it was a short blog post!!!
-Jamie