SQL 错误 SQL70001:在此上下文中无法识别此语句
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23579853/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error SQL70001: This statement is not recognized in this context
提问by user3623037
I have stored procedure in asp.net application as following:
我在 asp.net 应用程序中存储过程如下:
CREATE PROCEDURE [dbo].[step2-e]
@PI varchar(50),
@Balance int output ,
@Shipment_status varchar(50) output,
@ETA varchar(50) output,
@Forwarder varchar(50) output,
@Transit_time Time output,
@Shipping_date date output,
@Shipping_method varchar(50) output,
@Clearance_location varchar(50) output,
@Advance_payment varchar(50) output
@Balance_t varchar(50) output,
@Loading_date date output
@Balance_d date output
AS
Begin
select
@Advance_payment = [advance_payment] @Balance = [Balance],
@Shipment_status = [Shipment_status],
@ETA = [Eta], @Forwarder = [Forwarder],
@Transit_time = [Transit_time], @Shipping_date = [Shipping_date],
@Shipping_method = [Shipping_method],
@Clearance_location = [Clearance_location],
@Balance_d = [Balance_due_d],
@Balance_t = [Balance_due_t],
@Loading_date = [Loading_date]
from
Inbound
where
[Pi1] = @PI
End
GO
Select convert(date, [dbo].[step2-e] ,3);
GO
But I get error message after Go word on select says:-
但是在选择 Go word 后我收到错误消息说:-
Error SQL70001: This statement is not recognized in this context
错误 SQL70001:在此上下文中无法识别此语句
Ok I think there is problem of use Go word When I searched I found solution but in asp.net website not asp.net application. I found the solution herebut I can't find script file in asp.net application. Just I can find it in asp.net website. What can I do ?
好的,我认为使用 Go word 存在问题当我搜索时,我找到了解决方案,但在 asp.net 网站中而不是在 asp.net 应用程序中。我在这里找到了解决方案,但在 asp.net 应用程序中找不到脚本文件。只是我可以在asp.net网站上找到它。我能做什么 ?
采纳答案by marc_s
As you posted it, there's a comma missing between the first two elements in your SELECT
:
当您发布它时,您的前两个元素之间缺少一个逗号SELECT
:
select
@Advance_payment = [advance_payment] @Balance = [Balance],
^^^^
|
here there should be a comma!
So try this instead:
所以试试这个:
select
@Advance_payment = [advance_payment],
@Balance = [Balance],
..... (rest of your statement) ....
回答by Gabriel Marius Popescu
回答by Tanul
Comma missing from various places. After output in variables declaration:-
逗号在各个地方都不见了。在变量声明中输出后:-
@Advance_payment varchar(50) output
@Advance_payment varchar(50) 输出
@Loading_date date output
@Loading_date 日期输出
And in the select statement after [advance_payment]:
在 [advance_payment] 之后的 select 语句中:
@Advance_payment = [advance_payment]
@Advance_payment = [advance_payment]