Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Script Library
 Problem with xp_cmdshell

Author  Topic 

happyboy
Starting Member

21 Posts

Posted - 2009-04-20 : 23:59:33
Dear all, I have many DTS packet in SQL server 2000, and I wrote script to extract all of them to my disk but when I run ii just display in result list of SQL query analyzer not to my disk.

Please help me. thanks.

here my code

DECLARE @CMD varchar(1000)

DECLARE @TARGETDIR varchar(500)
SET @TARGETDIR = 'C:\'

DECLARE mycursor CURSOR FOR
SELECT distinct
'DTSRUN /S '
+ CONVERT(varchar(200), SERVERPROPERTY('servername'))
+ ' /E '
+ ' /N '
+ '"' + name + '"'
+ ' /F '
+ '"' + @TARGETDIR + name + '.dts"'
+ ' /!X'
FROM msdb.dbo.sysdtspackages P

OPEN mycursor

FETCH NEXT FROM mycursor INTO @CMD

WHILE @@FETCH_STATUS = 0
BEGIN
exec master..xp_cmdshell @CMD

FETCH NEXT FROM mycursor INTO @CMD
END

CLOSE mycursor
DEALLOCATE mycursor

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-05-09 : 22:47:31
Simply use DTS Package Migration Wizard and extract it to FileSystem.
Go to Top of Page
   

- Advertisement -