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
 Import/Export (DTS) and Replication (2000)
 bcp error

Author  Topic 

alejo46
Posting Yak Master

157 Posts

Posted - 2013-07-06 : 14:28:09
Good afternoon
Im trying to use bcp to queryout rows of a table with a where condition and yielded an error:
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'SALDOS_PREPAGO_DIARIOS_ALTAMIRA_SALDOS'.
SQLState = 37000, NativeError = 8180

This is the query:
bcp "SELECT * FROM dm1_elite.SALDOS_PREPAGO_DIARIOS_ALTAMIRA_SALDOS where FEC_SALDO >= '20120816'and FEC_SALDO <= '20120831'" queryout c:\prueba.txt -c -t"|" -Sdatamartsql -T

The server name is datamartsql and the table does really exist in the schema:
select @@servername
Ouput:DATAMARTSQL
exec sp_spaceused SALDOS_PREPAGO_DIARIOS_ALTAMIRA_SALDOS
Output:
SALDOS_PREPAGO_DIARIOS_ALTAMIRA_SALDOS 2147483647 882216720 KB 553476280 KB 240438240 KB 88302200 KB

I'd appreciate your help in advanced please

alejo46
Posting Yak Master

157 Posts

Posted - 2013-07-06 : 17:48:47
Now its working, because i add to the schema name DBO, so, instead of bcp "SELECT * FROM dm1_elite.SALDOS_PREPAGO_DIARIOS_ALTAMIRA_SALDOS i replace bcp "SELECT * FROM dm1_elite.DBO.SALDOS_PREPAGO_DIARIOS_ALTAMIRA_SALDOS

but i would like to know why bcp doesn't recognize the sentence dm1_elite.SALDOS_PREPAGO_DIARIOS_ALTAMIRA_SALDOS ?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2013-07-23 : 05:16:24
If dm1_elite is db name, you need to use three part name dbname.ownername.objectname

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -