jueves, 26 de abril de 2012 12:06
I have .csv file with names of columns in first string. I need to get in in readable view. I tried to use bulk insert from sql server but I need to create table before it. I dont know excatly the columns and their types. How is it possible to create table on the flight during bulk insert. Because if I try to create table before I get errors like
Msg 4863, Level 16, State 1, Line 1 Bulk load data conversion error (truncation) for row 23, column 7 (Priority). CREATE TABLE Investigation (Title VARCHAR(600), AssignedTo VARCHAR(600), BusinessPRiority VARCHAR(600), Category VARCHAR(600), Customer VARCHAR(600), Description VARCHAR(600), Priority VARCHAR(600), State VARCHAR(600) ) GO BULK INSERT Investigation FROM 'd:\1.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ) GO
Could you advice?
Todas las respuestas
jueves, 26 de abril de 2012 14:08
In all cases like this (that I faced) i use Import/Export wizard and let it create table for me. If for some reason the package fail because datatype mismatch (if it possible to check you datatype then you must change it in mapping in export/import wizard) if you not possible or have no aggregation or all you need is to see data go and map all column to nvarchar of acceptable length and run the package.
I hope this is helpful.
Please Mark it as Answered if it answered your question
OR mark it as Helpful if it help you to solve your problem
Elmozamil Elamir Hamid
- Marcado como respuesta amber zhangModerator viernes, 04 de mayo de 2012 4:18
jueves, 28 de junio de 2012 23:45
I know I'm a little late to the party, but just wanted to jump in and say that these are great resources: