Retrieving Package Version from SSIS Packages
If you need to read version information within an SSIS package, you can access one of the SSIS system variables:
Variable | Type | Description |
---|---|---|
VersionBuild | Int32 | The package version |
VersionComment | String | Comments about the package version |
VersionGUID | String | The unique identifier of the version |
VersionMajor | Int32 | The major version of the package |
VersionMinor | Int32 | The minor version of the package |
Finding Package SQL Server Version
To determine the Package SQL Server Version stored in a .dtsx file:
Extracting Values from .Dtsx Files
Using SQL Server
Refer to the following resources for SQL queries that retrieve information from .dtsx files stored in SQL Server:
Using a Programmatic Approach
Using Regular Expressions
The following code uses Regex to loop over .dtsx files, extracting package properties, including PackageFormatVersion:
Private Sub ReadPackagesInfo(ByVal strDirectory As String) Dim regexPattern As String = "(?<=""PackageFormatVersion"">)(.*)(?=</DTS:Property>)" ... Dim strPackageFormatVersion = Regex.Match(strContent, regexPattern, RegexOptions.Singleline).Value ...
Using an XMLParser
Private Sub ReadPackagesInfoUsingXmlParser(ByVal strDirectory As String) Dim ns As XNamespace = "www.microsoft.com/SqlServer/Dts" ... If Not xml.Root Is Nothing AndAlso Not xml.Root.Descendants(ns + "Property").Attributes(ns + "Name") Is Nothing AndAlso xml.Root.Descendants(ns + "Property").Attributes(ns + "Name").Where(Function(x) x.Value = "PackageFormatVersion").Count > 0 Then strPackageFormatVersion = xml.Root.Descendants(ns + "Property").Attributes(ns + "Name").Where(Function(x) x.Value = "PackageFormatVersion").FirstOrDefault.Parent.Value End If ...
Additional Resources
The above is the detailed content of How Can I Automate Version Number Retrieval from SSIS .dtsx Files?. For more information, please follow other related articles on the PHP Chinese website!