数据库名包含"-"字符,不能执行脚本?
为维护数据库,现写了几行脚本进行备份(按联机众书所说)
现取片断如下:
-- Create a full database backup for test-1
BACKUP DATABASE test-1
TO DISK = 'F:\db_backup\data\test-1.db '
WITH INIT
GO
-- Create a diff database backup for test-1
BACKUP DATABASE test-1
TO DISK = 'F:\db_backup\data\test-1.db '
WITH DIFFERENTIAL
GO
.
.
.
可我在添加作业的时候分析说用了不正确的字符 "- "
而我用企业管理器里的维护计划又可以备份这样名称的数据库
我要怎么解决这个问题啊,向大家请教,谢谢!
------解决方案--------------------怪,应该充许这个字符呀.
------解决方案--------------------BACKUP DATABASE [test-1]
TO DISK = 'F:\db_backup\data\test-1.db '
WITH DIFFERENTIAL
------解决方案--------------------我测试了 没有什么问题啊
------解决方案--------------------数据库名加[]
BACKUP DATABASE [test-1]
TO DISK = 'F:\db_backup\data\test-1.db '
WITH DIFFERENTIAL