【发布时间】:2013-05-15 08:14:12
【问题描述】:
我正在尝试在我们服务器上的计划任务上运行存储过程。存储过程运行一个查询,并为我们的库存程序提供我们的库存总量。
我已将任务设置为运行 sqlcmd.exe 并通过以下查询作为 .sql 文件中的变量传递。问题是我不能 100% 确定我传递了正确的变量,因为我从 SQL 中得到了一个错误。
以下是服务器在计算手头库存时运行的任务。
(@P1 int,@P2 int,@P3 bit,@P4 bit,@P5 bit)
declare @SessionID int
declare @Res int
exec @Res = stk_CompileStockOnHandOnDate
'2079-06-01',
null,
@P1,
@P2,
1,
@P3,
@P4,
@P5,
@SessionID out
select @Res Result, @SessionID SessionID
我在 SQLCMD 中得到的错误信息是
Msg 1050, Level 15, State 1, Server SERVER\SQLEXPRESS, Line 1
This syntax is only allowed for parameterized queries.
Msg 137, Level 15, State 2, Server SERVER\SQLEXPRESS, Line 6
Must declare the scalar variable "@P1".
关于我哪里出错了有什么想法吗?
【问题讨论】:
标签: sql sql-server-2008 scheduled-tasks