December 15, 2011 at 8:24 am
Hi All,
Is it possible to convert a field from "NVARCHAR" to "UTF-8" format in SQL Query itself. ?
..like...... select cast(name as "UTF-8") 🙂 Is anything like this possible ?
Thanks in advance,
Smith.
December 15, 2011 at 8:59 am
Not really. If you want to have the database store native UTF-8 strings, you need to store the binary represenation in a varbinary or binary datatype column.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
December 15, 2011 at 7:40 pm
Thank you.
But how can we get those NVARCHAR values in UTF-8 format now ?
Thanks again.
December 16, 2011 at 6:10 am
NVarchar is stored in (essentially) UTF-16. Can you convert from that in whatever solution you need UTF-8 in?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
December 16, 2011 at 6:34 am
GSquared (12/16/2011)
NVarchar is stored in (essentially) UTF-16.
So if I generate a CSV report based on some NVARCHAR fields (Without using any coversion objects), will that CSV report be in UTF-16 ?
Thanks.
December 16, 2011 at 6:36 am
Most CSV files I've worked with are .txt/.csv, which means ASCII, not Unicode at all.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
December 16, 2011 at 6:45 am
Thanks for the quick response.
Infact I have requirement here to generate a CSV report in UTF-16 format.
I did it using BIDS and in "Destination Connection Flat File" peoperties, I selected the "Unicode" check box. I was expecting the report to be in UTF-16. But it's not. It's in some other format.
Can you help me to achieve this pls. Number of data in the report is almost 7 million.
Thanks again.
December 16, 2011 at 7:03 am
That'll be UTF-8 in the Unicode .csv file, per what I'm seeing in a search or two on the subject. Try Googling/Binging "unicode csv" and see if that helps.
Converting between one and the other version of UTF is way outside my experience. Maybe someone else will happen along who can help more with that, but I'd just have to research it online via search engine, and I'm sure you can do that better for yourself than I can for you.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
December 16, 2011 at 7:18 am
No that was not in UTF-8 as well,
I had converted each and every field in 65001-(UTF-8) and selected code page as "UTF-8". But the final output was not in UTF-8.
Thought we can get the same in UTF-16, but no luck. Am not seeing any option to convert into UTF-16 at first place.
Yes, My investigation is on. Thanks a lot.
Smith.
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply