I have written code for stored procedure
ALTER PROCEDURE dbo.Store_Reviews_GetByProduct
@PortalID int,
@ProductID int
AS
SET NOCOUNT ON
SELECT r.ReviewID, r.PortalID, r.ProductID, r.UserName, r.Rating, LEFT(r.Comments,200), r.Authorized, r.CreatedDate, p.ModelName
FROM dbo.Store_Reviews r
LEFT JOIN dbo.Store_Products p
ON r.ProductID = p.ProductID
WHERE r.PortalID = @PortalID
AND r.ProductID = @ProductID
ORDER BY r.CreatedDate DESC
In that the LEFT function is not working, instead it gives no results or select none.
I have used Substring function as well like SUBSTRING(r.comments, 0, 200) but it also gives no result.
How can I get first 200 characters of comments column??
All answers are appreciated..
AdventureWorkssample DB....LEFT()is the issue. Does it return the entire content of comment if you remove it?