Wednesday, February 15, 2012

Error Handling in codes

Hi all,
This is related to renaming of a file with sql code.
I have a stroed procedure that deals with FTP on exchange server,
rename the file and then send email to the proper group.
Platforms: FTP server is on Windows 2003 Exchange server with IIS 6.0.,
SQL Server 2000.
The portion of the stored procedure is given below.
select
@.recips = '' + rtrim(notify) + '',
@.txt =
'This file is located on the server W2K3S1 ' +
'under the DATA\' + rtrim(l.username) + ' directory.' + char(13) +
char(13) +
'The file name: ' + rtrim(@.NewTarget) + char(13) +
'Date Received: ' + convert(varchar(25),LogTime) + char(13) +
'File Size: ' + convert(char(20), BytesRecvd) ,
@.sub = 'FTP Notification from ' + rtrim(description),
@.newfilename = rtrim(@.NewTarget),
@.oldfilename = rtrim(l.username)+'\'+ rtrim(Target)
from FTP l , Notify n
where LogID = @.logId and
lower(l.username) = lower(n.username)
exec master.dbo.xp_sendmail
@.recipients = @.recips,
@.message = @.msg,
@.query = @.cmd ,
@.subject = @.sub ,
@.no_header = 'TRUE', @.width = 2500
At present what it does is it sends email saying the file has been
renamed, whereas the file was not renamed actually in the server.
I was wondering whether I could add some error codes in between that
will check the file has been renamed on the FTP server successfully and
then will send email to the group.
Could anyone please suggest/advice what I can do in between select and
exec master.dbo.xp_sendmail?
Thanks a million in advance for your help.
Best regards,
mamunOn 21 Sep 2005 10:20:54 -0700, microsoft.public.dotnet.languages.vb
wrote:

>Hi all,
>This is related to renaming of a file with sql code.
>I have a stroed procedure that deals with FTP on exchange server,
>rename the file and then send email to the proper group.
>Platforms: FTP server is on Windows 2003 Exchange server with IIS 6.0.,
>SQL Server 2000.
>
>The portion of the stored procedure is given below.
(snip)
>At present what it does is it sends email saying the file has been
>renamed, whereas the file was not renamed actually in the server.
Hi mamun,
Not too surprising, since there is nothing in your code that would
actually try to rename the table. Or did you trim the quote a bit too
much, and leave out the code where the actual renaming is done?
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

No comments:

Post a Comment