Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


shellwait


shellwait

Author
Message
sam-433147
sam-433147
SSC Rookie
SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)

Group: General Forum Members
Points: 48 Visits: 123
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
Orlando Colamatteo
Orlando Colamatteo
SSCrazy Eights
SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)

Group: General Forum Members
Points: 8237 Visits: 14368
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
sam-433147
sam-433147
SSC Rookie
SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)

Group: General Forum Members
Points: 48 Visits: 123
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search