Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Bulk Insert. Strange Characters. Please, is really

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2011-05-04 : 18:56:05
Hello,

I am trying to bulk insert records in a SQL table from a CSV file:

use Test
go

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

DELETE FROM dbo.Subscribers

BEGIN TRANSACTION
BEGIN TRY
BULK INSERT dbo.Subscribers
FROM 'C:\Subscribers.csv'
WITH (CODEPAGE = 'RAW', FIELDTERMINATOR = ';', ROWTERMINATOR = '\n',
ROWS_PER_BATCH = 10000, TABLOCK)
COMMIT TRANSACTION
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
END CATCH

It works fine but in NAME column I get strange characters, different from the source in the CSV file.

For example:Mário becomes M+írio

I have no idea what else to try. Could someone please help me out?

It is urgent.

Thank You,

Miguel

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2011-05-04 : 19:40:09
Are you using Unicode characters? Any chance that there is a mismatch in the collation?

=======================================
Elitism is the slur directed at merit by mediocrity. -Sydney J. Harris, journalist (1917-1986)
Go to Top of Page

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2011-05-04 : 19:54:33
How can I check the collation?

I really don't know what is going on.

I tried everything I could find online and wasn't able to solve it.
Go to Top of Page
   

- Advertisement -