x

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.
more ▼

asked May 18 '11 at 06:34 PM in Default

pavanibukka gravatar image

pavanibukka
21 2 2 2

(comments are locked)
10|1200 characters needed characters left

4 answers: sort voted first
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.
more ▼

answered May 18 '11 at 06:47 PM

Tim gravatar image

Tim
35.5k 32 40 138

No, i cant use SSIS just i have to write stored Procedure for generating reports.
May 18 '11 at 06:53 PM pavanibukka
Ok, since SSIS is out take a look at this at this Article
May 18 '11 at 06:59 PM Tim
(comments are locked)
10|1200 characters needed characters left
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
more ▼

answered May 18 '11 at 09:52 PM

Fatherjack gravatar image

Fatherjack ♦♦
41.2k 72 77 107

(comments are locked)
10|1200 characters needed characters left
We can import multiple csv file through SSIS but in express edition i don't think there is any option for SSIS.
more ▼

answered Jul 26 '11 at 09:32 AM

manish_mannu82 gravatar image

manish_mannu82
1

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x1933
x401
x51
x34

asked: May 18 '11 at 06:34 PM

Seen: 2750 times

Last Updated: May 19 '11 at 12:45 AM