Replace character from generated csv file.

  • hi guys,

    i am generating two csv file through cmdshell and bcp and copying the content of both into a single csv file.

    coz the requirement is to transfer data from a table with columnname. so the first file i am creating of column header as csv and second one with data and merged both into the third one,

    but at last one special character is coming which is giving error when uploading the data to application.

    my scripts are these

    EXECUTE master.dbo.xp_cmdshell 'bcp "SELECT ''LoadID'',''LoadID:Products:Product'',''LoadID:Organizations:Customer'',''DisplayName'',''Quantity'',''SerialNumber''" queryout E:\Avalon\IBM_Warrenty\OutputFiles1\CoveredAssetsHeading.csv -c -t, -T -SCOLOCRMPRDCDI'

    Exec master..xp_cmdshell'bcp Avalon_IBM10102011..csv_CoveredAssets out E:\Avalon\IBM_Warrenty\OutputFiles1\CoveredAssets.csv -c -t, -T -SCOLOCRMPRDCDI'

    set @sql ='copy E:\Avalon\IBM_Warrenty\OutputFiles1\CoveredAssetsHeading.csv + E:\Avalon\IBM_Warrenty\OutputFiles1\CoveredAssets.csv E:\Avalon\IBM_Warrenty\OutputFiles1\OutputCSV\covered-assets.csv'

    EXEC master..xp_cmdshell @sql

    now i want to remove a special character from covered-assets.csv file

    can anyone help me out of this its really urgent.

    thanks.

  • create a view of the table which removes the character you are worried about then BCP the view.

    The probability of survival is inversely proportional to the angle of arrival.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply