|
Posted by Connie on 03/07/07 18:31
I am running the following script:
begin
set quoted_identifier off
declare @pk int
declare @where_clause varchar(100)
declare @file_name varchar (50)
declare @debug varchar (50)
Declare @cmd varchar (50)
--debug
/*if @Debug = 1
print @cmd
exec Master..xp_cmdShell @cmd */
-- begin cursor
DECLARE LOOKUP CURSOR FOR select pr.[id]
from plan_report pr, plan_version pv
where pv.plan_id = pr.plan_id and pv.status = '30' and pr.create_time
>= pv.update_time
OPEN LOOKUP
FETCH NEXT FROM LOOKUP INTO @pk
-- Loop through the list
WHILE @@FETCH_STATUS = 0
BEGIN
SET @where_clause = 'Where' + '[ID]' + '=' + cast(@pk as
varchar(10))
SET @file_name = 'C:\'+cast(@pk as varchar(10))+'.pdf'
exec sp_textcopy @srvname = 'MILNPPRODSQL',
@login = 'sa',
@password = 'W3Ot-@PirI#a',
@dbname = 'Naviplan',
@tbname = 'Plan_Report',
@colname = 'document',
@filename = @file_name,
@whereclause = @where_clause,
@direction = 'o' -- 'o' for output, 'i' for input
-- loop cursor
SET @pk = NULL
SET @where_clause = NULL
SET @file_name = NULL
FETCH NEXT FROM LOOKUP INTO @pk
END
-- cleanup
CLOSE LOOKUP
DEALLOCATE LOOKUP
end
This script runs with no issue in our Dev environment (which has a
restore of our production db) but when I run in production I get the
following error:
The system cannot find the path specified.
I can't figure out what path it is erroring on?? Both servers are
Windows 2003. The environmental variables on each server is
identical. Only difference I can think of is that our production
server is a clustered sql server and our dev server is not....
Any help would be greatly appreciated...
Thanks,
Connie
Navigation:
[Reply to this message]
|