Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dtsrun

Status
Not open for further replies.

rstum2005

Programmer
Jun 9, 2005
117
US
Ive created a stored procedure to do some joins and create a table in which I will use to produce a spreadsheet, on top of this I created a job to do this and for the second step ive added a xp_cmdshell 'dtsrun ect. script to run the DTS in which "should" create an excel spreadsheet onto my desktop for now. The problem lies in creating running this script. I can run it in my cmd prompt and it works fine, it runs the dts which then creates the spreadsheet and it appears on my desktop, But when I run the second step in the job it does not appear? any clues?

Thanks.
 
come to think about it the funny thing is the step in the Job does complete sucessfully but the spreadsheet does not appear on the desktop. (and yes I did hit refresh).
 
The excel sheel will be getting created on the servers hard drive in the same path as your profile on your workstation. To have it save to your local desktop you would need to give the server the full UNC path to your workstations desktop (as well as rights to the network share that it's using).

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
I see what you mean so in other words i need to change the path from somthing like "c:\documents and settings\ron\desktop" to "\\computername\share" ??
 
Ok I got it to work by doing the procedure above...Now is there a way to exec the xp_cmdshell from a stored procdure?

Right now with the line below it gives an error that says I cannot use the "use master" in the stored proc.

use master
exec xp_cmdshell 'dtsrun /Ssql1000d /Uidweb /Pacc /NExportElead_SpreadSheet'
 
well geez nevermind I just put a stored proc on master to exec the xp_cmdshell command and then added that sp to the other one. It works great thanks anyways....
 
You can call xp_cmdshell from another database's procedure by calling it via the 3 part name.
Code:
create procedure dbo.usp_Something as
exec master.dbo.xp_cmdshell ...

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top