Bulk insert - Fewer fields than in DB
-
Hi I want to use bulk insert in order to insert information from a CSV to the database. The CSV contains fewer fields than the DB. I don't want to use a format file, I want to specify all the options within the with clause. I need to map the fields in the CSV to the fields within the Database table. Thanks, Clint
-
Hi I want to use bulk insert in order to insert information from a CSV to the database. The CSV contains fewer fields than the DB. I don't want to use a format file, I want to specify all the options within the with clause. I need to map the fields in the CSV to the fields within the Database table. Thanks, Clint
I can't help with that; I use bcp with a format file to load a table defined specifically to accept the bulk-loaded data, then I move the data to the target tables(s).
-
Hi I want to use bulk insert in order to insert information from a CSV to the database. The CSV contains fewer fields than the DB. I don't want to use a format file, I want to specify all the options within the with clause. I need to map the fields in the CSV to the fields within the Database table. Thanks, Clint
I can't help with a bulk insert - however would doing an import via Enterprise Manager be an option? I mention this because you can map fields through the import wizard and it should cover what you want to do. Of course this is a once off option for ad-hoc jobs, but if doing a bulk insert is not absolutely necessary and this is an ad-hoc job I'd suggest looking at this option. In Enterprise Manager it is under Tools/Data Transformation Services/Import Data... You an also get to this via the SQL Server tab on your start menu under Import and Export Data Hope this helps...
You always pass failure on the way to success.