I am running a PowerShell script(which runs a loop) using XP-cmdshell. I am trying insert the error output into a temp table. My script returns single line warning as well as multiple line errors from PowerShell. The errors are inserted into multiple cells rather than single cell. I know PowerShell returns error in multiple line. Is there a way to accommodate the errors in the single cell and also how to remove CrLf(SQL carriage return and line break) while inserting the error from PowerShell to temp table.
Insert into #ErrorLog
Exec master.dbo.xp_cmdshell <My Script>