Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Duplication of DB
Message
De
12/04/2005 04:46:26
Jon Neale
Bond International Software
Wootton Bassett, Royaume Uni
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01003617
Message ID:
01003620
Vues:
23
You could backup the database and then restore (called something else) it by calling a stored procedure in SQL Server using SPT.

----------------------------------------
CREATE PROCEDURE resetdata
@dbname varchar(20),
@filename varchar(80)
AS

BACKUP DATABASE @dbname TO DISK = @filename
RESTORE DATABASE @dbname FROM DISK = @filename
----------------------------------------

To call it form VFP do something similar to below;
--------------------------------------------
lcConnectString = "driver=SQL Server;server=ISC34;uid=sa;pwd=jon;Database=master;app='';Encrypt='';"
lnConnectHandle = SQLSTRINGCONNECT(lcConnectString)

cDatabase = "PPWin"
cLocation = "c:\tmp\PPWin.Bak"

lnresult = Sqlexec(lnConnectHandle, [EXEC resetdata ?cDatabase, ?cLocation])
if lnresult < 0
messagebox("Error Occurred with restore")
else
messagebox("Restore Complete")
endif
----------------------------------------------

You will need to tweak this abit but I hope it gives you some idea.

>Hi to all,
>
>I need to duplicate an MS SQL DB.
>How can I perform this from VFP ?
>
>Thank you for reply.
>Gaetano
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform