我的存储过程中有一个查询:
IF @backup = 0
BEGIN
SELECT sql = 'BACKUP DATABASE MyDatabase TO DISK="'+@file+'"';
END
@file
是nvarchar(MAX)
和backup
是int
。
如果我执行如下存储过程:
DECLARE @return_value int
EXEC @return_value = [dbo].[usp_cp_backup_restore_db]
@backup = 0,
@file = N'C:\backupFiles\MyDatabase.bak'
但结果变成:
BACKUP DATABASE ContentPlatform TO DISK="C:\backupFiles\MyDatabase.bak"
我想出现BACKUP DATABASE ContentPlatform TO DISK='C:\backupFiles\MyDatabase.bak'
,因为正确的格式是
BACKUP
DATABASE MyDatabase TO
DISK='C:\MyDatabase.bak'
有什么建议么 ?
谢谢