我在file .bat
"%SQLCMD_PATH%sqlcmd.exe" -d Data1^
-S Server01 ^
-E ^
-i Script01.sql ^
-v ^
Instance="Server01" ^
Database="Data1" ^
Database2="DATA2"
所以文件调用脚本如下 在我的剧本中我有这个:
@command=N'
:setvar Database2 "$(Database2)"
:setvar Database "$(Database)"
USE [$(Database)];
INSERT INTO [$(Database2)].dbo.aaa
Select *
FROM [$(Database)].dbo.bbb AS bbb'
然后当我在CMD commande
中执行文件时,我有此消息Database2 scripting variable not defined