SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Writing text files as Unicode


Writing text files as Unicode

Author
Message
sqldriver
sqldriver
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2302 Visits: 2536
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)


Orlando Colamatteo
Orlando Colamatteo
SSC-Forever
SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)

Group: General Forum Members
Points: 41612 Visits: 14413
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
sqldriver
sqldriver
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2302 Visits: 2536
It's going to be a few drinks before I attempt that.

Blink
Orlando Colamatteo
Orlando Colamatteo
SSC-Forever
SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)

Group: General Forum Members
Points: 41612 Visits: 14413
Heh, no need to drink. At first, SSIS will make your head spin anyway :-D

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search