Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2003
    Posts
    3

    Question Unanswered: CONSTANTS in bcp .fmt files

    Hi,

    How can we insert CONSTANTS in table columns using bcp's .fmt files? In case SQLLoader, we can specify CONSTANTs in .ctl files. How can it be done in case of bcp utility?

    Thanks in advance
    Vijay

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    You can't! BCP does not support this.
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    Oct 2003
    Posts
    3
    Originally posted by Paul Young
    You can't! BCP does not support this.
    Any workaround used normally?

    Thanks

  4. #4
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    Either add the data to your file before BCPing or run an update script to add the data after BCPing the file.
    Paul Young
    (Knowledge is power! Get some!)

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Originally posted by vijay_kumar74
    Any workaround used normally?

    Thanks
    What do you mean by Constant?

    UPDATE myTable SET col1 = 'Something'

    ???????????????????????????????????????????
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  6. #6
    Join Date
    Oct 2003
    Posts
    3
    Yes, I think I'll go by updating table columns with the "CONSTANT" (e.g. $PROGRAM_NAME) values after running bcp.

    Thanks for the help!

  7. #7
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    You can check %ERRORLEVEL% to see if the BCP went okay and then follow up with an OSQL command to update the table. Not eloquent but functional.
    Paul Young
    (Knowledge is power! Get some!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •