【发布时间】:2014-04-02 12:07:27
【问题描述】:
我有一个执行 SQL 任务,它查找数据库最新备份的路径并用它填充变量 (User::BackupFilePath)
我想将它传递给另一个任务,该任务将生成一个恢复数据库脚本并填充另一个用于恢复数据库的变量。
Select (
'ALTER DATABASE [Database] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
RESTORE DATABASE [Database]
FROM DISK = ''' + **BackupFilePath** + ''' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 5
ALTER DATABASE [Database] SET MULTI_USER
GO'
) as RestoreScript
生成字符串的第二部分是返回此错误消息
[Execute SQL Task] Error: Executing the query "Select 'ALTER DATABASE [xxxx..." failed with the following error: "An error occurred while extracting the result into a variable of type (DBTYPE_I4)". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
我使用的是 Visual Studio 2008 专业版
【问题讨论】:
-
命令之间不应该有分号吗?