General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
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
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only