I am trying to convert excel file rows into columns using C# code
string command=";WITH CTE AS(SELECT * FROM (SELECT IPAddress, Slot1,Slot2,Slot3,Slot4 FROM ["+ sheet1 +"] ) T UNPIVOT ( SlotPort FOR N IN (Slot1 ,Slot2 ,Slot3 , Slot4))P )SELECT SlotPort, IPAddress FROM CTE";
Am using above code to achieve the mentioned process. But I am getting the below error.
Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
Please anyone help to resolve this issue. Thanks in advance