February 6, 2018 at 9:50 am
Hello everyone,
I am able to import one pipe delimited file at a time with the script below but can't get it to import multiple files at once. I tried to use a wildcard in the file name but it won't allow it (ie. .txt or eJ.text).
Any assistance that you can provide would be greatly appreciated.
Thank you,
BULK INSERT databasename.tablename
FROM 'C:\temp\EJ_Detail_file.txt'
WITH
(
FIELDTERMINATOR ='|',
FIRSTROW = 2,
ROWTERMINATOR ='\n'
)
February 7, 2018 at 5:06 am
I don't believe you can bulk insert multiple files at once.
Probably the easiest way to do it is with a simple SSIS package.
Here's an example: https://www.mssqltips.com/sqlservertip/2874/loop-through-flat-files-in-sql-server-integration-services/
February 7, 2018 at 7:23 am
Jim Mackenzie - Wednesday, February 7, 2018 5:06 AMI don't believe you can bulk insert multiple files at once.
Probably the easiest way to do it is with a simple SSIS package.Here's an example: https://www.mssqltips.com/sqlservertip/2874/loop-through-flat-files-in-sql-server-integration-services/
It can also be done using the OS level command of "START" either through PowerShell or a nice call to the OS through xp_CmdShell.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply