SQL语句无法执行高手帮忙分析
语句如下,其中ETeam-PMS-DB为数据库名,该语句在查询分析器中可执行,但在企业管理器中无法添加作业进行自动执行.SELECT*FROMETeam-PMS-DB.d...
语句如下,其中ETeam-PMS-DB为数据库名,该语句在查询分析器中可执行,但在企业管理器中无法添加作业进行自动执行.SELECT * FROM ETeam-PMS-DB.dbo.sysfiles
use ETeam-PMS-DB
BACKUP LOG ETeam-PMS-DB WITH TRUNCATE_ONLY
DBCC SHRINKFILE(ETeam-PMS-DB_Log,10)
错误提示如下:
---------------------------
Edit Job Step - (local)\clearETeam-PMS-DB
---------------------------
The Server detected the following syntax errors in the command:
Error 911: Could not locate entry in sysdatabases for database 'ETeam'. No entry found with that name. Make sure that the name is entered correctly.
Line 1: Incorrect syntax near '-'.
Are you sure this is what you want?
---------------------------
Yes No
---------------------------
经查为数据库命名中不能有"-",是否为这个原因,查为什麽能在查询分析器中执行,出高分请高手解答.
用方括号把数据库名括起来试试
比如:use [ETeam-PMS-DB]
如果还不行,建议你在存储过程中执行,并给这个数据库一个别名
回答者:shaoling_cn - 试用期 一级 1-31 12:10 展开
use ETeam-PMS-DB
BACKUP LOG ETeam-PMS-DB WITH TRUNCATE_ONLY
DBCC SHRINKFILE(ETeam-PMS-DB_Log,10)
错误提示如下:
---------------------------
Edit Job Step - (local)\clearETeam-PMS-DB
---------------------------
The Server detected the following syntax errors in the command:
Error 911: Could not locate entry in sysdatabases for database 'ETeam'. No entry found with that name. Make sure that the name is entered correctly.
Line 1: Incorrect syntax near '-'.
Are you sure this is what you want?
---------------------------
Yes No
---------------------------
经查为数据库命名中不能有"-",是否为这个原因,查为什麽能在查询分析器中执行,出高分请高手解答.
用方括号把数据库名括起来试试
比如:use [ETeam-PMS-DB]
如果还不行,建议你在存储过程中执行,并给这个数据库一个别名
回答者:shaoling_cn - 试用期 一级 1-31 12:10 展开
2个回答
展开全部
SELECT * FROM 'ETeam-PMS-DB.dbo.sysfiles'
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2008-01-31
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询