Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BCP INTO a table

Status
Not open for further replies.

JayKusch

MIS
Oct 30, 2001
3,199
US
Morning Folk.

I am trying to BCP a file INTO a temp table. I am able to BCP a temp table out with the following command:

bcp ##BCPOut out c:\temp\BCPOut.txt -Usa -P -S -c

Has anyone the key to unlock the solution?


Thanks

J. Kusch
 
With BULK INSERT, it is only possible to use a local temp table (ie #temptable). This may be the case with bcp also.

What error are you getting when trying to bcp in?
 
James,

Local Temporary tables (single #) exist for the duration of a session so it is not possible to use a local temp table TO BCP in or out.

Jay,

Have you tried qualifying the name of the global temporary table with the database name. In this case the database would be tempdb. (i.e., tempdb..##BCPOut OR tempdb.dbo.##BCPOut) Terry L. Broadbent - DBA
SQL Server Page:
If you want to get the best answer for your question read faq183-874.
 
Not using a local temp table. I understand the issue of using a local table. That is why my post show the use of a global table in the syntax.

Was reading elsewhere that a global table would work BUT I should have read with both eyes open.

Terry ... you are correct, at least by this link .

Have not tried to see if prefixing it w/ tempdb would do the trick since I found another alternative to the BCP into a temp table hurdle.

Since the alternative I chose had no bearing on the thread, I have not responded back with my alternative.

Once again, thanks for all the great help. I may see if I can find some time and verify if the prefixing would work!
Thanks

J. Kusch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top