shellwait

  • i run a Tsql query that move's a file from one computer to another

    set @sql='move '+@file1+' '+@file2

    EXEC master..xp_cmdshell @sql , NO_OUTPUT

    now, i want the query to wait until the file arrive's to its destination and only

    if FileExists to continue the next action

    is there something like shellwait until the xp_cmdshell finish is job?

    thanks

    sam

  • sam-433147 (2/20/2013)


    i run a Tsql query that move's a file from one computer to another

    set @sql='move '+@file1+' '+@file2

    EXEC master..xp_cmdshell @sql , NO_OUTPUT

    now, i want the query to wait until the file arrive's to its destination and only

    if FileExists to continue the next action

    is there something like shellwait until the xp_cmdshell finish is job?

    thanks

    sam

    It might be possible, but a feat like this is far easier to achieve in PowerShell, SSIS, .NET...pretty much any other programming or scripting language besides CmdShell. This is not to mention that accessing the file system from T-SQL brings with it a ton of baggage when it comes to security and auditing. Is moving this process out of T-SQL an option for you? If so, I would strongly recommend changing the approach and disabling xp_cmdshell on the Instance if at all possible. If you want help implementing this task in any of the technologies I mentioned I'd be happy to assist.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • thanks for the reply and the willingness to help

    I'm not familiar with PowerShell or other scripting language besides sql

    any assistance will be wonderful

    sam

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

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