SSIS executing package with parameter problem

  • hi,

    I had tried the following code for executing a package by passing paramaters.

    declare @cmd varchar(1000)

    declare @ssispath varchar(1000)

    declare @fileName varchar(1000)

    declare @database varchar(1000)

    declare @tableName varchar(1000)

    set @ssispath = 'C:\Package.dtsx'

    set @fileName = 'C:\temp\test.csv'

    set @tableName = 'test'

    select @cmd = 'dtexec /F "' + @ssispath + '"'

    select @cmd = @cmd + ' /SET \Package.Variables[User::fileName].Properties[Value];"' + @fileName + '"'

    select @cmd = @cmd + ' /SET \Package.Variables[User::fileName].Properties[Value];"' + @tableName + '"'

    exec Master..dbo.xp_cmdshell @cmd

    The error i got is

    Could not find server 'Master' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.

    I havent used any linked server .What might be the problem?..

    Regards

    vijay

  • You have an extra period between Master and dbo, thus SQL Server thinks that Master is a linked server not a database. Try this:

    exec Master.dbo.xp_cmdshell @cmd

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply