nellster
asked on
Insert table via csv with non matching columns?
Hi all,
I am building a solution using SQL Server Express 2005. Part of this solution will be the ability to bulk upload a database table from a csv file once a day. The csv file will contain approximately 200 rows with about 50 fields in each row. The database table will contain columns that will not be present on the csv.
I am relatively new to "bulk inserts" and updating from csv/text files so could appreciate some assistance as to the best way of approaching this. I have imported from a CSV to MS Access before and could manipulate and match cvs columns to database table columns but I'm not sure as to the best way to do it in SQL 2005.
Many thanks for assistance in advance!
Nellster
I am building a solution using SQL Server Express 2005. Part of this solution will be the ability to bulk upload a database table from a csv file once a day. The csv file will contain approximately 200 rows with about 50 fields in each row. The database table will contain columns that will not be present on the csv.
I am relatively new to "bulk inserts" and updating from csv/text files so could appreciate some assistance as to the best way of approaching this. I have imported from a CSV to MS Access before and could manipulate and match cvs columns to database table columns but I'm not sure as to the best way to do it in SQL 2005.
Many thanks for assistance in advance!
Nellster
If it's only 200 rows, BULK INSERT into a #TempTable and then select the columns you need into your target table
ASKER
Thanks for the reply bamboo7431.
I get the TempTable storage but could you expand abit on the "Select columns into target table" bit?
thanks,
Nellster
I get the TempTable storage but could you expand abit on the "Select columns into target table" bit?
thanks,
Nellster
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.