Link to home
Start Free TrialLog in
Avatar of kgittinger
kgittingerFlag for United States of America

asked on

How to add a wildcard to a bulk insert command?

How to add a wildcard to a bulk insert command? I am useing Bulkinsert to brgin in data.  Data is always in the same directry with the same prefix (extr_claim), the suffix changes by adding a date (such as_03292011) to the end, then the .txt extension.  There will always be just 1 fine in the directry with the prefix.  How and I add something like FROM ' mypath \extr_claim*.txt' to my script?
Avatar of batchakamal
batchakamal
Flag of India image

SELECT * FROM filenames WHERE fn_name LIKE 'mypath\extr_claim%.txt'
Avatar of kgittinger

ASKER


How do I add that to the following?
BULK INSERT #tmp_Harvard_Feed
FROM 'mypath\extr_claim.txt'
WITH
(
ROWTERMINATOR = '\n'
 )
ASKER CERTIFIED SOLUTION
Avatar of Som Tripathi
Som Tripathi
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If xp_cmdshell is disabled, you can enable it using -

exec sp_configure 'advanced' , 1 
reconfigure with override

exec sp_configure 'xp_cmdshell' , 1 
reconfigure with override

exec sp_configure 'advanced' , 0 
reconfigure with override

Open in new window