SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 SSIS and Import/Export (2012)
 Import multiple files from folder
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

christian-hansen
Starting Member

3 Posts

Posted - 07/03/2014 :  03:17:49  Show Profile  Reply with Quote
Hello,
I need to import a lot of document from a folder to my sql server.
Can i do that with a bulk insert?
Each day there is coming a new file in the folder, and filename is the current date. So each day there comes a file with the date as file name. Is there a way just to import all files in the folder? or an easy way to automatic import the newest file from the folder?
Can anyone help me?

Regards Christian.

SwePeso
Patron Saint of Lost Yaks

Sweden
30265 Posts

Posted - 07/03/2014 :  03:55:35  Show Profile  Visit SwePeso's Homepage  Reply with Quote
1. Create a variable to reflect current date.
2. Use a FOREACHLOOP container with a file mask from the variable created in step 1.



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

christian-hansen
Starting Member

3 Posts

Posted - 07/03/2014 :  05:22:23  Show Profile  Reply with Quote
So if we take the code it is something like:

DECLARE @CurrentTime DATETIME
set @CurrentTime = GETDATE()

And how should the bulk then look like?

Regards Christian
Go to Top of Page

christian-hansen
Starting Member

3 Posts

Posted - 07/03/2014 :  05:23:13  Show Profile  Reply with Quote
I mean the FOREACHLOOP*
:)

Regards Christian.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000