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

Raja TPosted Feb 11, 2016, 12:03 AM
Prasad AnumoluPosted Feb 10, 2016, 1:57 PM
Raja TPosted Feb 10, 2016, 4:31 AM
Sujeet SumanPosted Feb 10, 2016, 3:44 AM
Chandu KumawatPosted Feb 10, 2016, 3:26 AM