SQL Server 2012 BCP API - bcp_init fails for local temporary tables - by btrigg

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 780567 Comments
Status Closed Workarounds
Type Bug Repros 3
Opened 3/4/2013 5:03:49 AM
Access Restriction Public


Hi, we are migrating to SQL Server 2012 using the SQL Server Native Client 11.0.  We have found we can no longer use the BCP api with a local temporary table as the call to bcp_init it fails with:

"SQL Diag:42000:1:11525:[Microsoft][SQL Server Native Client 11.0][SQL Server] The metadata could not be determined because statement 'select * from #Test' uses a temp table.\n"

We are using BCP to insert data into ~40 tables asynchronously. We use the local temporary table to remove duplicates from the source data, then merge into the database tables to ignore any duplicates in the destination table. Using real tables would be difficult to manage in this scenerio.
Sign in to post a comment.
Posted by Raphael Affolter on 9/17/2014 at 3:05 AM
The original problem has been resolved by Cumulative Update package 2 for SQL Server 2012 SP2.


Posted by Jason Markantes on 4/10/2014 at 2:10 PM
This has been a problem for us also using oracle's PeopleSoft's SQR reports program. Everything worked for years in SQL Server 2005, we upgraded to 2012, and now we're running into this error. A rewrite of these reports would be significant, so we're looking for the root cause and an easier work around before committing developer resources. oracle support is pretty well stuck on pointing out it's a SQL Server bug (referring to this webpage), so now we're stuck in that fun infinite loop of vendor's pointing at each other. :)

In our particular case we're creating a new temp table, and then within oracle's SQL framework looping through the table and running further queries on that data. One report uses 17 tables, creating 11 temp tables to hold working data while creating the report. A rewrite to use permanent working tables appears to us to be quiet messy.
Thank you,
Posted by Raphael Affolter on 1/7/2014 at 2:12 AM
I know, that it is the current behaviour, but it worked in previous versions of Native Client. So it is a bug. I cannot understand, why this issue is simply closed as By Design. We need a solution for this problem or we cannot use Native Client 11.
Posted by Microsoft on 7/26/2013 at 12:48 PM
Unfortunately this is the current server behavior. There is no plan to change it in the near term.
Posted by mattweir on 5/8/2013 at 7:57 PM
We are having this same problem too
Posted by Microsoft on 4/16/2013 at 1:19 PM
Thanks for youe feedback. Our Dev is taking a look.
Posted by Microsoft on 4/16/2013 at 1:19 PM
Thanks for youe feedback. Our Dev is taking a look.