sql - SINGLE_NCLOB requires a UNICODE (widechar) input file -


i have followed process:

  1. open notepad , enter text: "hello world"
  2. save ansi file as: c:\helloworld.txt

i run following query:

select * openrowset(bulk 'c:\helloworld.txt',single_clob) test 

the text appears in column called: bulkcolumn.

i this:

  1. open notepad , enter text: "hello world"
  2. save unicode file as: c:\helloworld.txt

i run following query:

select * openrowset(bulk n'c:\helloworld.txt',single_nclob) test 

the error is:

single_nclob requires unicode (widechar) input file. file specified not unicode.

why this?

you need double-check how saved "unicode" file. in windows / .net / sql server, term "unicode" refers "utf-16 little endian (le)". when dealing utf-16 big endian (be), referred "unicode big endian" or "big endian unicode". utf-8 utf-8.

i created file in notepad , went "save as" , selected "unicode" "encoding" drop-down , worked fine statement using:

select * openrowset(bulk n'c:\temp\openrowset_bulk_nclob-test.txt', single_nclob) [test]; 

if re-saved other encoding, got error message seeing.

i used notepad++ , in "encoding" menu selected "encode in ucs-2 little endian". ucs-2 , utf-16 identical code points u+0000 through u+ffff , there no utf-16 option in notepad++ closest thing. , yep, worked.

so somehow did not save file "unicode". if selected "unicode big endian" in notepad, not "unicode" in terms of how windows using term, if valid unicode encoding.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -