September 14, 2009 at 1:36 pm
I have to export a field from a SQL table to a *.csv file to be imported into a web app. The export requires a ridiculous format that uses :: and ||. I'm able to run a select on the field & everything just fine, but when I use it to export to a .csv flat file destination from SSIS, it blows up with a reference to not being able to convert to uni-code. When I've had that error before, I've just CAST the field to nchar or nvarchar. When I do that with this field, though, it cuts it off at the first |.
create table pc_adc_feed3
(facilities varchar(255))
insert pc_adc_feed3
(facilities)
values ('"TNU Main Campus::Mackey::102||TNU Main Campus::Mackey::103"')
select cast(facilities as nvarchar) from pc_adc_feed3
Help, please!
September 14, 2009 at 10:47 pm
Your problem is happening because you are not specifying the length when you are casting your results. The default length is 30 - the first "|" just happens to be character 30.
Try the following ...
create table pc_adc_feed3
(facilities nvarchar(255))
insert pc_adc_feed3
(facilities)
values ('"TNU Main Campus::Mackey::102||TNU Main Campus::Mackey::103"')
select cast(facilities as nvarchar(255)) from pc_adc_feed3
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply