Search

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

Active

2
0
Sign in
to vote
Type: Bug
ID: 780567
Opened: 3/4/2013 5:03:49 AM
Access Restriction: Public
0
Workaround(s)
1
User(s) can reproduce this bug
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.
Details (expand)

Product Language

English

Version

SQL Server 2012 - Standard Edition

Category

SQL Engine

Operating System

Windows Server 2008 (all editions)

Operating System Language

English

Steps to Reproduce

Link to sqlncli11.lib

Create temporary table using existing schema. (we use SELECT * INTO #temp from dbo.DestTable with (nolock) WHERE 1=0)

call bcp_init:

bcp_init(hDbc, destTableName,NULL,NULL,DB_IN);

Actual Results

bcp_init 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"

Expected Results

bcp_init succeeds (does not return 0).

Platform

X64

Virtualization

 
File Attachments
0 attachments
Sign in to post a comment.
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.
Sign in to post a workaround.