By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,740 Members | 790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,740 IT Pros & Developers. It's quick & easy.

Bulk Insert with default value

P: 1
We have sp's in place that do BULK INSERTS from txt files into the tables. This works fine, however they have asked us to add a field that identifies accounting ctr. The only thing that identifies accounting ctr is the last three letters of the text file being used for the BULK INSERT.

How would you suggest that I do this? Is there a way to add a default value to the .fmt or schema files for the text fields, or in the BULK INSERT statement itself?

Below is part of the process using now:
BULK INSERT DSLTesting..ExtractCRB
FROM '\\server\c$\DSLReporting\crbcfl.txt'
WITH (FORMATFILE = '\\server\c$\DSLReporting\crb.fmt')
BULK INSERT DSLTesting..ExtractCRB
FROM '\\server\c$\DSLReporting\crbctt.txt'
WITH (FORMATFILE = '\\server\c$\DSLReporting\crb.fmt')
BULK INSERT DSLTesting..ExtractCRB
FROM '\\server\c$\DSLReporting\crbflg.txt'
WITH (FORMATFILE = '\\server\c$\DSLReporting\crb.fmt')

What I need to add to new field in ExtractCRB (ACCTCTR) is CFL, CTT, FLG during the bulk inserts. This data is not in the .txt file being inserted, only identified by the last three letters of the .txt file being processed. So while it's importing the first file (crbcfl.txt) the value for that field will be 'CFL', then change for the appropriate .txt import throughout the process. Hope this makes sense!

Help?!?
Apr 9 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.