0

我有一个观点,虽然我可以执行此语句而不会出现任何错误:

SELECT * from vwShippingNoticeBase
order by InvoiceNum

当我尝试用这个完全相同的语句创建一个存储过程时,我得到一个错误:

create PROCEDURE [dbo].[upSELECT_shippingNoticeOrderByInvoiceNum]
AS
BEGIN
SET NOCOUNT ON;
SELECT * FROM vwShippingNoticeBase
order by invoiceNum

错误:

消息 102,级别 15,状态 1,过程 upSELECT_shippingNoticeByDateRange,第 7 行
“invoiceNum”附近的语法不正确。

很奇怪!

4

1 回答 1

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!
于 2012-08-26T09:39:28.637 回答