I have a csv file and i need to import it to a table in sql 2005 or 2008. The column names and count in the csv are different from the table column names and count. The csv is splitted by a ';' .
Example
CSV FILEcontents:
FirstName;LastName;Country;Age
Roger;Mouthout;Belgium;55
SQL Person Table
Columns: FName,LName,Country
Best Answer
You can use a format file when importing with bcp:
Create a format file for your table:
Edit the import file. The trick is to add a dummy row for the field you want to skip, and add a '0' as server column order.
Then import the data using this format file, specifying your inputfile, this format file and the seperator: