开发者

Is there a way to create and use global data structures (specifically c# struct) in SSIS 2008 R2

I have some complex data that I need to pass from one SSIS (SQL Server Integration Services) script task to another SSIS script task.

It is essentially an array of this C# struct:

struct GeneratedReport {
        public string ReportCode;
        public string FileName;
        public int NoOfDataRows;
};

The problem is that I need a way to define the struct at a global level in the package so tha开发者_运维问答t all script tasks within the package can use this global data structure. I can find no way of doing it and I don't know where I would declare such a structure.

Any help much appreciated!


There are couple approaches you might try:

1) create a separate assembly that defines this structure, reference it from every script task. But you'll need to manage separate assembly, deploy it with the package, etc - still, if you have complex structure, it is worth it.

2) use loosely-typed structure, rather than strong-typed one. E.g. use Hashtable object, and put this Hashtable object into SSIS variable.

No separate assembly, but your code now is different:

reportCode = (string)((Hashtable)variableValue)["ReportCode"];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜