SQL Server will definitely store "£" correctly in a varchar
or nvarchar
column using collation Latin1_General_CI_AS
. I see it happening every day in the software I maintain.
I think the problem lies in the way that the text file is encoded and read in. "£" has a code point value of 163 in both Windows-1252 and Unicode. However, in Extended ASCII (e.g. DOS code page 850), "£" has the value 156, and "ú" has the value 163. Is your code attempting to convert the csv text encoding before passing the data to SQL Server? If the csv is encoded as UTF-8, then no conversion from ASCII is necessary.
UPDATE
Looking on MSDN, it appears that the bulk insert
command performs character set conversion. OEM is the default option if not specified.
CODEPAGE = { 'ACP' | 'OEM' | 'RAW' | 'code_page' }
The default is definitely not what you want here. Ideally, you would specify UTF-8 (CODEPAGE = '65001'
). However, MSDN says that UTF-8 is not supported.
I suggest that you change the encoding of your CSV file to Windows-1252, then use the CODEPAGE = 'ACP'
option to import the data.