Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 SQL Error .

Author  Topic 

admin001
Posting Yak Master

166 Posts

Posted - 2002-09-13 : 06:44:49
Hello ,

We use a bcp command to export data out from the database tempdb to another server in one table with a format file .
All this time it was running fine when suddenly we received an error stating that :

SQLState=01000,NativeError=2701
Warning=[Microsoft][ODBC SQL Server Driver][SQL Server]Database name 'tempdb' ignored, referencing object in tempdb.

Is it because of the bcp is taking a long time to export out the data ?
Any ideas ?

Thank you very much.


nr
SQLTeam MVY

12543 Posts

Posted - 2002-09-13 : 06:50:18
I take it you have a global temp table ##... (a temp table #... won't work as bcp gets a new connection).

It is sayng that it recognises it is accessing a temp table which are always in tempdb so it is ignoring the database.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

admin001
Posting Yak Master

166 Posts

Posted - 2002-09-13 : 07:10:09
Hello nr,

Absolutely richtig !! Yes right . In the format file we have an entry with beginning with bcp tempdb.##sde_ex out d:\\....and then the path.

But can you please explain what does it mean by 'when bcp gets new connection ' . Do you mean the connection to the source server or has the name of the source server changed ?

Thanks once again .

Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-09-13 : 14:44:06
I believe that what nr is talking about here is that BCP will startup a new SPID (connection) to execute its steps, and not use the same one that created the temp table. Therefore it has to be a global temp table, or BCP would never find the table.

Since temp tables are always in tempdb, you don't have to prefix the name with 'tempdb.'

Go to Top of Page

admin001
Posting Yak Master

166 Posts

Posted - 2002-09-16 : 05:06:03
Hello ,

Yes , the table is a global temp table starting with ## signs . But i am still confused over the command of the bcp which is :

bcp tempdb..##sde_Ex out h:\\PLANNING\HFD13011.dhg /m0 /T /S SQLprod /fH:\personalplanung\sap\ArS0098.fmt.

Is it still necessary to use the tempdb when the global temp. tables are always created in tempdb database ? Will it work or it generates an error or just warning . The bcp will fail , i guess .
I don't know how this script was working till now if this is the case .

Any thoughts ? Thanks once again for all your replies .

Go to Top of Page
   

- Advertisement -