• opc.three (4/12/2013)


    SET @sql = 'EXEC master.sys.xp_cmdshell ' +

    '''COPY \\server\SurveyComputing\Sample\SentToSPSS\' + @data_file +

    '+\\server\SurveyComputing\Sample\SentToSPSS\' + @file_name +

    ' \\server\SurveyComputing\Sample\SentToSPSS\' + @file_name + '_copied /Y /B''';

    It took some tinkering, but it finally works. The issues were my fault. I didn't see that the @data_file variable already had the file path concatenated, so it was unnecessary in the copy statement. After that it was copying the headers to the bottom of the new file, so I had to change the order of the statement.

    But yeah, we've got full Unicode files writing. Thank you again for the last two days of your help and time. It's much appreciated.

    --Combine 2 files above

    SET @sql = 'EXEC master.sys.xp_cmdshell ' + '''COPY ' + @filePath + @file_name + '+' + @data_file + ' ' + @filePath + @file_name + ' /Y /B''';

    exec(@sql)