Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Writing text files as Unicode Expand / Collapse
Author
Message
Posted Friday, April 12, 2013 3:07 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Today @ 2:24 PM
Points: 492, Visits: 2,041
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)

Post #1441938
Posted Friday, April 12, 2013 5:26 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, December 18, 2014 8:51 PM
Points: 7,140, Visits: 12,763
You're very welcome! I would be happy to assist with any SSIS questions you might have down the line too

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1441970
Posted Friday, April 12, 2013 5:48 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Today @ 2:24 PM
Points: 492, Visits: 2,041
It's going to be a few drinks before I attempt that.

Post #1441978
Posted Friday, April 12, 2013 5:57 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, December 18, 2014 8:51 PM
Points: 7,140, Visits: 12,763
Heh, no need to drink. At first, SSIS will make your head spin anyway

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1441980
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse