SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 bcp error
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

alejo46
Posting Yak Master

Colombia
127 Posts

Posted - 07/06/2013 :  14:28:09  Show Profile  Reply with Quote
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

Colombia
127 Posts

Posted - 07/06/2013 :  17:48:47  Show Profile  Reply with Quote
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

India
22744 Posts

Posted - 07/23/2013 :  05:16:24  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000