Что плохого в этой процедуреОшибка SQL: Неправильная ошибка синтаксиса
CREATE PROCEDURE [dbo].[Question_ReadBySort]
-- Add the parameters for the stored procedure here
(
@PageNumber int,
@Gid bigint,
@Sorttype int,
@Df int
)
AS
BEGIN
if @Gid=0
BEGIN
With Cust AS
(SELECT * ,
ROW_NUMBER() OVER (order by q_id DESC) as RowNumber
from tbl_Question
where q_del=0)
END
ELSE
BEGIN
With Cust AS
(SELECT * ,
ROW_NUMBER() OVER (order by q_id DESC) as RowNumber
from tbl_Question
where q_del=1)
END
END
GO
и эта ошибка происходит в SQL Server:
Msg 156, Level 15, State 1, Procedure Question_ReadBySort, Line 23
Incorrect syntax near the keyword 'END'.Msg 156, Level 15, State 1, Procedure Question_ReadBySort, Line 31
Incorrect syntax near the keyword 'END'.
Вы последовательно сокращали каждую часть запроса, чтобы устранить виновников и нуль в реальной проблеме, или просто здесь, прося нас выяснить это с нуля? –