用SQL语言解决下列问题:3.创建一个数据库名为somename并改名“student”(用SP-renemedb)
答案:2 悬赏:0 手机版
解决时间 2021-03-07 01:25
- 提问者网友:我的未来我做主
- 2021-03-06 02:20
急用啊!
最佳答案
- 五星知识达人网友:青灯有味
- 2021-03-06 03:40
--建立somename数据库
CREATE DATABASE somename
ON
( NAME = 'somename_data',
FILENAME = 'c:\program files\microsoft sql server\mssql\data\somename_data.mdf',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5 )
LOG ON
( NAME = 'somename_log',
FILENAME = 'c:\program files\microsoft sql server\mssql\data\somename_log.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB )
GO
--停止somename库的使用进程
declare @str varchar(100)
select @str=spid from master..sysprocesses where dbid=db_id('somename')
exec('kill '+@str)
--重命名数据库名
EXEC sp_renamedb 'somename', 'student'
CREATE DATABASE somename
ON
( NAME = 'somename_data',
FILENAME = 'c:\program files\microsoft sql server\mssql\data\somename_data.mdf',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5 )
LOG ON
( NAME = 'somename_log',
FILENAME = 'c:\program files\microsoft sql server\mssql\data\somename_log.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB )
GO
--停止somename库的使用进程
declare @str varchar(100)
select @str=spid from master..sysprocesses where dbid=db_id('somename')
exec('kill '+@str)
--重命名数据库名
EXEC sp_renamedb 'somename', 'student'
全部回答
- 1楼网友:荒野風
- 2021-03-06 05:09
搜一下:用SQL语言解决下列问题:3.创建一个数据库名为somename并改名“student”(用SP-renemedb)
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯