Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

shellwait Expand / Collapse
Author
Message
Posted Wednesday, February 20, 2013 12:39 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Saturday, November 15, 2014 1:41 AM
Points: 41, Visits: 68
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
Post #1422251
Posted Thursday, February 21, 2013 8:14 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:12 AM
Points: 7,135, Visits: 12,746
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
Post #1422619
Posted Thursday, February 21, 2013 10:04 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Saturday, November 15, 2014 1:41 AM
Points: 41, Visits: 68
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
Post #1422687
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse