2012-02-20 37 views
0

有一個選項可以在SQL Server中保存SSIS配置。這似乎是一個好主意。這樣我的SSIS包不需要任何文件訪問權限來運行。編輯已存儲在SQL Server中的SSIS Config的工具?

但是它存儲的格式不是用戶友好的。有沒有一種工具可以讓你以友好的方式查看和編輯這些設置?

+0

你現在怎麼訪問它們?通過Management Studio或查詢? Jason在他的「SSIS 31天」系列中對此有何建議? http://www.jasonstrate.com/2011/01/31-days-of-ssis-sql-server-configuration-1831/ – 2012-02-21 00:54:43

+0

我製作了一套SSIS包和ac#windows窗體,可以讓你移動一組從一臺服務器到另一臺服務器的某個過濾器的行數。我不會分享它,所以只是一個想法給你。 – Sam 2012-02-22 20:34:03

回答

0

觀看時,我們總是隻用SELECT *

我沒有創建一個出口一個特定的過濾器爲我們的配置表一個進程(我們稱之爲sysdtsconfig),你也可以看到我們已經與延長它我們自己的元信息。

CREATE PROCEDURE 
    [dbo].[ConfigurationExport] 
(
    @TargetFilter VARCHAR (60) 
) 
AS 
BEGIN 
    SET NOCOUNT ON 
    DECLARE 
     @DynamicStatement varchar(max) 
    , @ConfigurationFilter nvarchar(150) 
    , @ConfiguredValue nvarchar(255) 
    , @PackagePath nvarchar(255) 
    , @ConfiguredValueType nvarchar(20) 
    , @Application nvarchar(50) 
    , @Category nvarchar(50) 
    , @Subcategory nvarchar(50) 
    , @Comment nvarchar(255) 

    -- set using statement 
    SELECT 
     @DynamicStatement = '' 

    -- purge existing 
    SELECT 
     @DynamicStatement = @DynamicStatement + replicate('-', 80) + char(13) + char(10) 
     + '-- Remove existing settings' + char(13) + char(10) 
     + replicate('-', 80) + char(13) + char(10) 

    SELECT 
     @DynamicStatement = @DynamicStatement + 'DELETE C' + char(13) + char(10) + 
    'FROM' + char(13) + char(10) 
     + ' dbo.SYSDTSCONFIG C' + char(13) + char(10) + 'WHERE' + char(13) + char(10) 
     + ' C ConfigurationFilter = ''' + @TargetFilter + '''' + char(13) + char(10) 
    + char(13) + char(10) 

    -- add current settings 
    SELECT 
     @DynamicStatement = @DynamicStatement + replicate('-', 80) + char(13) + char(10) 
     + '-- Load values for ' + @TargetFilter + char(13) + char(10) 
     + replicate('-', 80) + char(13) + char(10) + char(13) + char(10) 

    DECLARE Csr cursor for 
    SELECT 
     ConfigurationFilter 
    , ConfiguredValue 
    , PackagePath 
    , ConfiguredValueType 
    , Application 
    , Category 
    , Subcategory 
    , Comment 
    FROM 
     dbo.sysdtsconfig 
    WHERE 
     ConfigurationFilter = @TargetFilter 


    SET NOCOUNT ON 
    OPEN Csr 
    FETCH NEXT FROM Csr INTO 
     @ConfigurationFilter 
    , @ConfiguredValue 
    , @PackagePath 
    , @ConfiguredValueType 
    , @Application 
    , @Category 
    , @Subcategory 
    , @Comment 
    WHILE (@@fetch_status <> -1) 
    BEGIN 
     IF (@@fetch_status <> -2) 
     BEGIN 
     SELECT 
      @DynamicStatement = @DynamicStatement + 'INSERT INTO' + char(13) + char(10) 
      + ' dbo.SYSDTSCONFIG' + char(13) + char(10) 
      + '(' + char(13) + char(10) 
      + ' ConfigurationFilter' + char(13) + char(10) 
      + ', ConfiguredValue' + char(13) + char(10) 
      + ', PackagePath' + char(13) + char(10) 
      + ', ConfiguredValueType' + char(13) + char(10) 
      + ', Application' + char(13) + char(10) 
      + ', Category' + char(13) + char(10) 
      + ', Subcategory' + char(13) + char(10) 
      + ', Comment' + char(13) + char(10) 
      + ')' + char(13) + char(10) 
      + 'SELECT' + char(13) + char(10) 
      + ' ' + IsNull('''' + @ConfigurationFilter + '''', 'NULL') 
      + ' AS ConfigurationFilter' + char(13) + char(10) 
      + ', ' + IsNull('''' + @ConfiguredValue + '''', 'NULL') + ' AS ConfiguredValue' + char(13) + char(10) 
      + ', ' + IsNull('''' + @PackagePath + '''', 'NULL') + ' AS PackagePath' + char(13) + char(10) 
      + ', ' + IsNull('''' + @ConfiguredValueType + '''', 'NULL') + ' AS ConfiguredValueType' + char(13) + char(10) 
      + ', ' + IsNull('''' + @Application + '''', 'NULL') + ' AS Application' + char(13) + char(10) 
      + ', ' + IsNull('''' + @Category + '''', 'NULL') + ' AS Category' + char(13) + char(10) 
      + ', ' + IsNull('''' + @Subcategory + '''', 'NULL') + ' AS Subcategory' + char(13) + char(10) 
      + ', ' + IsNull('''' + @Comment + '''', 'NULL') + ' AS Comment' + char(13) + char(10) + char(13) + char(10) 

     END 
     FETCH NEXT FROM Csr INTO 
      @ConfigurationFilter 
     , @ConfiguredValue 
     , @PackagePath 
     , @ConfiguredValueType 
     , @Application 
     , @Category 
     , @Subcategory 
     , @Comment 
    END 
    CLOSE Csr 
    DEALLOCATE Csr 

    IF (len(@dynamicStatement) > 256) 
    BEGIN 
     SELECT rtrim('-- Warning, text may be truncated!' + char(13) + char(10) 
     + '-- Tools, Options, Query Results, SQL Server, Results to Text -> ' + char(13) + char(10) 
     + '--  Set Maximum number of characters to 8192') 
     UNION ALL 
     SELECT 
      rtrim(@DynamicStatement) 
    END 
    ELSE 
    BEGIN 
     SELECT 
      @DynamicStatement 
    END 
END 

如果不適合你,只要抓住姆拉登的SSMS Tools Pack(免費),並用它來編寫腳本你的配置表中。

相關問題