can I use a synonym with the SQLBulkCopy class for the DestinationTableName rather than the actual table name? RRS feed

  • Question

  • it seems I can't use a synonym as I get the error "Failed to obtain column collation information for the destination table. If the table is not in the current database the name must be qualified using the database name (e.g. [mydb]..[mytable](e.g. [mydb]..[mytable]); this also applies to temporary-tables (e.g. #mytable would be specified as tempdb..#mytable)."

    It works fine with the actual tablename.

    Is there a work around for this or will this be considered as a fix in the near future?  We use synonyms a lot as our database names sometimes change.

    Thank you


    Tuesday, August 18, 2015 11:20 PM

All replies

  • try the following link http://stackoverflow.com/questions/13845412/sqlbulkcopy-failed-to-obtain-column-collation-information-for-the-destination-ta
    Thursday, August 20, 2015 1:09 AM
  • Thank you, but I do believe it's related to using a synonym rather than permissions or dots in the table name.  I had found this link https://connect.microsoft.com/SQLServer/feedback/details/816143/net-sqlbulkcopy-writetoserver-t-sql-synonym-and-sp-tablecollations-100, which Microsoft had responded to a year ago stating they wouldn't fix it the issue immediately.  I just thought I'd post this to let them know that it indeed still is an issue that users will encounter and to see if they'd respond as to if/when it would be fixed.  I will have to put the tablenames in the config file now so I won't have to recompile code when my database name changes due to version changes in development (the reason I'm using a synonym in the first place).


    Friday, August 21, 2015 12:02 AM