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

xp_cmdshell in stored procedure not the same result as cmd prompt Expand / Collapse
Author
Message
Posted Tuesday, May 20, 2014 10:40 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, August 20, 2014 12:32 PM
Points: 6, Visits: 26
I have a stored procedure that uses xp_cmdshell to execute an executable. I made code changes to the executable and compiled a new build. The stored procedure that uses xp_cmdshell to execute is not recognizing the code changes but when I run the same command from cmd prompt it works fine. Any ideas?
Post #1572791
Posted Thursday, June 5, 2014 10:34 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 9:09 AM
Points: 2,397, Visits: 6,649
dirk.dromgoole (5/20/2014)
I have a stored procedure that uses xp_cmdshell to execute an executable. I made code changes to the executable and compiled a new build. The stored procedure that uses xp_cmdshell to execute is not recognizing the code changes but when I run the same command from cmd prompt it works fine. Any ideas?


First thought would be more than one instance of the executable on the system.
Post #1578134
Posted Friday, June 6, 2014 11:33 PM
SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 8:28 AM
Points: 4,458, Visits: 3,911
I'm thinking the same thing. When you shell out, are you giving it the full path and filename to the executable? If not, then you're probably executing the wrong copy of it, so you're not getting the results from the new one.


Tally Tables - Performance Personified
String Splitting with True Performance
Best practices on how to ask questions
Post #1578564
Posted Saturday, June 14, 2014 3:10 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 6:32 AM
Points: 7,135, Visits: 12,745
Sounds like a reason to move away from xp_cmdshell. What is the executable doing and can it be hosted on a machine other than a machine hosting SQL Server and be executed via a remote shell?

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1580873
Posted Sunday, June 15, 2014 4:57 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 6:55 AM
Points: 3,075, Visits: 3,190
Hi
When you make changes to the executable you can recompile the SP.
You could also create the SP with recompile option, so it removes and creates new plans for next executions.





Igor Micev,
SQL Server developer at Seavus
www.seavus.com
Post #1580926
Posted Tuesday, June 17, 2014 12:20 PM This worked for the OP Answer marked as solution
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, August 20, 2014 12:32 PM
Points: 6, Visits: 26
The issue was that a copy of the program that was being executed was somehow locked into cache on the server. After the program was unlocked it picked up the revised program.
Post #1582512
Posted Tuesday, June 17, 2014 12:25 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 9:09 AM
Points: 2,397, Visits: 6,649
dirk.dromgoole (6/17/2014)
The issue was that a copy of the program that was being executed was somehow locked into cache on the server. After the program was unlocked it picked up the revised program.

Very curious here, could you share some details on this?
Post #1582516
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse