Using OPENROWSET with formatfile SQLDECIMAL data type

  • Hi

    I have created a BCP format file using -n (native) parameter and exported a table using it (many tables infact).

    I then use OPENROWSET T-SQL to import the values into another DB using JOINs etc but I get this error message for any imports where the data contain SQLDECIMAL data types:

    "The bulk data source does not support the SQLNUMERIC or SQLDECIMAL data types."

    If I instead BCP using -c (Character data) then all is well, but I didn't really want to use -c, but -n (native is quicker and hides the data somewhat from a casual onlooker).

    As creating the format file declares -n (Native) SQLDECIMAL is mentioned in the format file, so when using OPENROWSET to an identical table in another DB I would have expected it to work (SQLDECIMAL to SQLDECIMAL after all - both DBs are SQL 2005).

    Can I simply not use OPENROWSET for native data exports where SQLDECIMAL or SQLNUMERIC data types are in use - or is there a way to achieve this?

    Thanks

  • I don't believe you need a format file when you export or import using -n with BCP or Bulk Insert.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Did you ever get an answer to this? I, too, am experiencing this same issue.

    Jeff Moden replied, but he seems to have replied to the question "do I need to use a format file..." not to the question that you asked.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply