i want to insert csv file with special character how can csv file to sql server database with special character
alter procedure test_123asBULKINSERT ExcelToDBFROM 'D:\EtilizedataSaba211009.csv'WITH (CODEPAGE = 'RAW', FIELDTERMINATOR = ',',ROWTERMINATOR = '\n', ROWS_PER_BATCH = 10000, TABLOCK)GOthis procedure isnot working
chaitali
2009-11-04 09:04:33
not working how?
Alex Reitbort
2009-11-04 09:19:05
A:
You can use the BULK INSERT T-SQL command (it also has a command line version):
davek
2009-11-04 09:04:44
A:
Besides SQL BULK insert, you could also check out the SQL Server Integration Services, if you have to do this just once.
In SQL Server Management Studio, go to the Object Explorer, find your database, right click on it, and then choose "Tasks > Import Data". This brings up the SSIS wizard, which allows you to pick a source (your CSV file), a target (your SQL Server database+table), and it supports picking just certain fields, renaming them and much more.
For "do it once" operations, this is quite a nice and useful wizard.
marc_s
2009-11-04 10:21:32
However, if you have data in columns that might be larger than 50 characters, you need to adjust the column sizes. I've never yet imported a file this way where I didn't have to do that for at least one column.
HLGEM
2009-11-04 14:08:13
Hmm.... I just inserted a large number of Excel sheets with columns of 255 chars of width - no manual intervention necessary.... (SSIS 2008)
marc_s
2009-11-04 14:18:18