Hi When i try and do an if else if in a cursor it keeps underlining the else part saying incorrect syntax near 'else', why does it keep doing this, I am confused where I need to use begin...end as well in cursor and at if statements:declare @ExtractStr VARCHAR(100), @RawData VARCHAR(100)declare c1 cursor for select column1 from dbo.Sheet1$ open c1 fetch next from c1 into @RawData while @@FETCH_STATUS = 0 BEGIN if CHARINDEX(',', @RawData, 0) <> 0 AND CHARINDEX('XYZ', @RawData, 0) <> 0 set @ExtractStr = substring(@RawData, CHARINDEX(' ', @RawData, 0) + 1, len(@RawData)) print 'Remaining string is: ' + substring(@RawData, CHARINDEX(' ', @RawData, 0) + 1, len(@RawData)) else if CHARINDEX(',', @RawData, 0) = 0 print 'Value in c1 is: ' + @RawData end fetch next from c1 into @RawData close c1 deallocate c1I have rows in column one where data is as follows:column1=======232wewe456ffff454tyuu721tnji, 583sdfsAnd I am trying to filter and display any rows like the bold one above basically showing the string after the comma. Eventually I would like to copy this value into a new row and copy the other data in that row to create a duplicate, like this:column1=======232wewe456ffff454tyuu721tnji 583sdfsAny ideas, is there a better way than a cursor?G