question

pavanibukka avatar image
pavanibukka asked

stored procedure to import multiple CSV file in to SQL server express 2005

In my project i have folder containing multiple CSV files need to import them in to SQL server express 2005. Using Bulk Insert command we can import one file in to table not multiple file. Need to wrire a stored procedure to import all files in to sql server 2005.
sql-server-2005stored-proceduressql-server-expresscsv
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Tim avatar image
Tim answered
Are the file names consistent? Could you not just have multiple bulk insert commands? There isn't anything stopping you from doing a bulk insert of file1.csv, then bulk insert file2.csv and both insert into the same table. Any particular reason for doing this with a sproc instead of using SSIS? SSIS was built for this type of process. If the file names are not consistent and you can't use SSIS then I would start looking at powershell.
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

pavanibukka avatar image pavanibukka commented ·
No, i cant use SSIS just i have to write stored Procedure for generating reports.
0 Likes 0 ·
Tim avatar image Tim commented ·
0 Likes 0 ·
Fatherjack avatar image
Fatherjack answered
I would seriously consider using LogParser, I explain how it can be done in my blog here http://www.simple-talk.com/community/blogs/jonathanallen/archive/2010/07/05/93370.aspx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

manish_mannu82 avatar image
manish_mannu82 answered
We can import multiple csv file through SSIS but in express edition i don't think there is any option for SSIS.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.