I have a view and while I can execute this statement without any error:
SELECT * from vwShippingNoticeBase
order by InvoiceNum
when I try to make a stored procedure out of this exact same statement, I get an error:
create PROCEDURE [dbo].[upSELECT_shippingNoticeOrderByInvoiceNum]
AS
BEGIN
SET NOCOUNT ON;
SELECT * FROM vwShippingNoticeBase
order by invoiceNum
Error:
Msg 102, Level 15, State 1, Procedure upSELECT_shippingNoticeByDateRange, Line 7
Incorrect syntax near ‘invoiceNum’.
Very strange!
How about adding an
ENDto your stored procedure ….