renshen555

-----执行sp_configure 启用xp_cmdshell
exec sp_configure \'show advanced options\',1
go
reconfigure
go
exec sp_configure \'xp_cmdshell\',1
go reconfigure
go
-----通过xp_cmdshell 创建文件夹
exec xp_cmdshell \'mkdir e:\project\'
----创建数据库
----用完后请关闭xp_cmdshell
exec sp_configure \'show advanced options\',0
go
reconfigure
go
----创建及删除文件夹
exec xp_cmdshell \'md e:\aa\'
exec xp_cmdshell \'rd e:\aa /q\'
----rd删除文件夹,del删除文件、/q安静模式下,不然会有提示
use master
go
if exists(select * from sysdatabases where name=\'MySchool\')
drop database MySchool
create database MySchool
on primary
(
name =\'MySchool_data\',
filename =\'d:\MySchool_data.mdf\',
size =10,
filegrowth=10%
)
log on
(
name =\'project\MySchool_log\',
filename =\'d:\MySchool_log.ldf\',
size =3,
maxsize=20,
filegrowth=1
)
----sp_help \'表名\'

分类:

技术点:

相关文章: