ASP中怎么实现SQL数据库备份、恢复!
1、ASP中怎么实现SQL数据库备份、恢复!
答:asp在线备份sql server数据库:
1、备份
<%
SQL="backup database 数据库名 to disk='"&("backup")&"\"&""&"'"
set cnn=("")
"driver={SQL Server};Server=服务器名;uid=sa;pwd="
SQL
on error resume next
if err<>0 then
"错误:"&
else
"数据备份成功!"
end if
%>
2、恢复
<%
SQL="Restore database 数据库名 from disk='"&("backup")&"\"&""&"'"
set cnn=("")
"driver={SQL Server};Server=服务器名;uid=sa;pwd="
SQL
on error resume next
if err<>0 then
"错误:"&
else
"数据恢复成功!"
end if
%>
注:以上语句是把数据备份到磁盘的backup目录下,。
2、ASP中能修改SQL数据库结构吗?
答:ALTER TABLE
名称
ALTER TABLE — 更改表属性
语法
ALTER TABLE table [ * ]
ADD [ COLUMN ] column type
ALTER TABLE table [ * ]
ALTER [ COLUMN ] column { SET DEFAULT value | DROP DEFAULT }
ALTER TABLE table [ * ]
RENAME
[ COLUMN ] column TO newcolumn
ALTER TABLE table
RENAME TO newtable
ALTER TABLE table
ADD table constraint definition
Inputs
table
试图更改的现存表的名称.
column
现存或新的列名称.
type
新列的类型.
newcolumn
现存列的新名称.
newtable
表的新名称.
table constraint definition
表的新的约束定义.
New table constraint for the table
输出
ALTER
《asp中怎么实现sql数据库备份》 来自淘豆网m.daumloan.com转载请标明出处.