[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Cannot add rows to sysdepends for the current stored procedure

Posted on 2006-05-26
3
Medium Priority
?
1,864 Views
Last Modified: 2010-05-18
Hi experts,

Is anyone knows what the probolm of this scripts ? It won't executing because "Cannot add rows to sysdepends for the current stored procedure because it depends on the missing object 'usp_copy'. The stored procedure will still be created."
Please advice. thanks.

/***Copy files***/
USE MASTER
IF OBJECT_ID ('dbo.usp_copy') IS NOT NULL
DROP PROC dbo.usp_copy
GO

CREATE PROCEDURE USP_COPY AS

DECLARE @cmd VARCHAR(5000)
SET @cmd = 'mkdir c:\data\WeeklyData_'+ REPLACE(CONVERT(varchar(11),GETDATE(),100),' ','')
exec master..xp_cmdshell @cmd
set @cmd = 'copy c:\data\FTP_DOWNLOAD\*.zip c:\data\WeeklyData_'+ REPLACE(CONVERT(varchar(11),GETDATE(),100),' ','')
exec master..xp_cmdshell @cmd
set @cmd = 'copy c:\data\FTP_DOWNLOAD\*.Z c:\data\WeeklyData_'+ REPLACE(CONVERT(varchar(11),GETDATE(),100),' ','')
exec master..xp_cmdshell @cmd

EXEC usp_copy
GO
0
Comment
Question by:LIULIHUA
  • 2
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 150 total points
ID: 16768935
the procedure you create contains the call to run itself at the end, which is NOT what you want to do:

/***Copy files***/
USE MASTER
IF OBJECT_ID ('dbo.usp_copy') IS NOT NULL
DROP PROC dbo.usp_copy
GO

CREATE PROCEDURE USP_COPY AS

DECLARE @cmd VARCHAR(5000)
SET @cmd = 'mkdir c:\data\WeeklyData_'+ REPLACE(CONVERT(varchar(11),GETDATE(),100),' ','')
exec master..xp_cmdshell @cmd
set @cmd = 'copy c:\data\FTP_DOWNLOAD\*.zip c:\data\WeeklyData_'+ REPLACE(CONVERT(varchar(11),GETDATE(),100),' ','')
exec master..xp_cmdshell @cmd
set @cmd = 'copy c:\data\FTP_DOWNLOAD\*.Z c:\data\WeeklyData_'+ REPLACE(CONVERT(varchar(11),GETDATE(),100),' ','')
exec master..xp_cmdshell @cmd

GO

-- call the procedure outside the procedure:
EXEC USP_COPY
0
 

Author Comment

by:LIULIHUA
ID: 16769124
Thank you angelIII,

When I call the precedure outside the procedure works, the folder is created and all the files are copied, EXCEPTE it goes loop, the procedure goes nonstop.....
0
 

Author Comment

by:LIULIHUA
ID: 16776800
Hi,

The problem has been solved, just sapareated each of the command line as a singal sp. thanks.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question