Solved

SQL Server backup fails from vb6 application

Posted on 2010-11-09
4
544 Views
Last Modified: 2012-05-10
I have a backup stored procedure gratiously provided by a member of this great establishment.  It runs fine from the server but fails occasionally when run from my vb6 app.  It doesn't timeout because it only runs about 20 seconds and the timeout is set for 60 seconds.

The error message simply says: 'Backup Failed'

Any ideas would be appreciated!!!

Jerry
0
Comment
Question by:JDL129
  • 2
4 Comments
 
LVL 7

Expert Comment

by:tlovie
ID: 34096653
Does the VB6 application run with the same login credentials as when you run it from the server?  What does the proc do?
0
 

Author Comment

by:JDL129
ID: 34097569
Thanks for the response!!!

Attached is the stored procedure that I run from vb6.  The error I get is:Backup Failed
The application logs into the SQLServer database and calls the attached.

Thanks,

Jerry
set ANSI_NULLS ON

set QUOTED_IDENTIFIER ON

GO

ALTER PROCEDURE [dbo].[sp_Backup]

@BackupPath nvarchar(200)

As

Declare @WeekDay tinyint

     Declare @Backup_File nvarchar(200)

     Declare @Desc nvarchar(255)                 

     Declare @Name nvarchar(128)                 



SET @WeekDay = DATEPART(weekday, CURRENT_TIMESTAMP)



IF @WeekDay = 7 -- change this value to meet the weekday you want to perform FULL BACKUP

BEGIN



     Set @Backup_File = @BackupPath + '\BarCodeSQL.bak'

     Set @Desc = 'Full Backup'

     Set @Name = 'Barcode FULL BACKUP'



     BACKUP DATABASE [BarCodeSQL] TO DISK = @Backup_File 

      WITH 

       DESCRIPTION = @Desc

     ,NAME = @Name

Return @@Error

END

ELSE

BEGIN



     Set @Backup_File = @BackupPath + '\BarCodeSQL.bak_' + DATENAME(weekday, CURRENT_TIMESTAMP) + '.bak'

     Set @Desc = 'Incremental Backup'

     Set @Name = 'Barcode ' + DATENAME(weekday, CURRENT_TIMESTAMP) + ' DIFF BACKUP'



     BACKUP DATABASE [BarCodeSQL] TO DISK = @Backup_File

     WITH DIFFERENTIAL,

      DESCRIPTION = @Desc, NOFORMAT, NOINIT

     ,NAME = @Name

     ,SKIP, NOREWIND, NOUNLOAD

Return @@Error

END

Open in new window

0
 
LVL 2

Accepted Solution

by:
SQLLover earned 125 total points
ID: 34114355
run a profiler to monitor what happed , i think the problem is in passing @BackupPath parameter from vb  
0
 

Author Closing Comment

by:JDL129
ID: 34138403
Thanks for the input!!!!!!!!!!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now