我有一个视图,虽然我可以执行此语句而没有任何错误:
SELECT * from vwShippingNoticeBase
order by InvoiceNum
当我尝试用完全相同的语句创建存储过程时,我收到错误:
create PROCEDURE [dbo].[upSELECT_shippingNoticeOrderByInvoiceNum]
AS
BEGIN
SET NOCOUNT ON;
SELECT * FROM vwShippingNoticeBase
order by invoiceNum
错误:
Msg 102,Level 15,State 1,Procedure upSELECT_shippingNoticeByDateRange,Line 7
'invoiceNum'附近的语法不正确。
很奇怪!
答案 0 :(得分:3)
如何在存储过程中添加END
....
CREAT PROCEDURE [dbo].[upSELECT_shippingNoticeOrderByInvoiceNum]
AS
BEGIN
SET NOCOUNT ON;
SELECT * FROM vwShippingNoticeBase
ORDER BY invoiceNum
END -- <<<==== you're missing the END for the BEGIN you have!