DECLARE @str varchar(50)='Hello, world'; /* SQL SERVER QUERY TO SPLIT STRING FROM COMMA AND GET LEFT AND RIGHT PART */
SELECT LEFT(@str, CHARINDEX(',', @str)-1) as LeftPart, RIGHT(@str, LEN(@str)-CHARINDEX(',', @str)) as RightPart;
Error is
Must declare the scalar variable "@str"
why it is coming ? if any one know tell me friends