I implement a stored procedure like this:
BUt it keeps saying that there's an error syntax ';' the semicolon in front of With. If I ran it in the sql query, it's fine.Code:ELSE IF (@Command = 'GETUSERS_NEWS') --newsletter ;With Emails As (SELECT u.Email, ROW_NUMBER() OVER (ORDER BY u.Email) AS RowNumber FROM Users u LEFT JOIN Notifications n ON u.Username = n.Username WHERE u.Suspend IS NULL AND u.IsDelete IS NULL AND (n.NewsLetter = @Alert OR n.NewsLetter IS NULL)) SELECT * FROM Emails WHERE RowNumber BETWEEN @RowStart AND @RowEnd




Reply With Quote
