SQL?????????????????????????????
???????????? ???????[ 2013/4/16 10:35:44 ] ????????
????2???????????
???????ú???????????????????????????????????????£?
DECLARE @sql NVARCHAR(500)
DECLARE @dbname NVARCHAR(100)
DECLARE @dbname1 NVARCHAR(100)
DECLARE @dbname2 NVARCHAR(100)
DECLARE @sdbname1 NVARCHAR(100)
DECLARE @sdbname2 NVARCHAR(100)
DECLARE @path NVARCHAR(200)
DECLARE @dispath NVARCHAR(200)
DECLARE @dpath1 NVARCHAR(200)
DECLARE @dpath2 NVARCHAR(200)
DECLARE @count NVARCHAR(10)
DECLARE @n int
SET @n=1
SET @path='E:DBTestBackupTRUEDB.bak'
SET @dispath='E:DBTestDATA'
SET @sdbname1='TESTDB_0'
SET @sdbname2='TESTDB_0_log'
WHILE @n<101
BEGIN
SET @count=LTRIM(STR(@n))
SET @dbname='TESTDB_'+ @count
SET @dbname1='TESTDB_'+ @count+'.mdf'
SET @dbname2='TESTDB_'+ @count+'_log.ldf'
SET @dpath1=@dispath+@dbname1
SET @dpath2=@dispath+@dbname2
SET @sql='restore database '+@dbname+' from disk='"+@path+"' with move '"+@sdbname1+"' to '"+@dpath1+"'??move '"+@sdbname2+"' to '"+@dpath2+"'STATS=10??replace'
EXEC(@sql)
SET @n=@n+1
END
?????????????'E:DBTestBackupTRUEDB.bak'??????λ??????????????100?????С?
????3???????????
???????????????????????????????????
DECLARE @dname NVARCHAR(20)
DECLARE @sql NVARCHAR(200)
DECLARE @n int
SET @n=1
WHILE @n<101
BEGIN
SET @dname='TESTDB_'+LTRIM(STR(@n))
SET @sql='DROP DATABASE'+@dname
EXEC(@sql)
SET @n=@n+1
END
?????????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11