Re: how to use bcp command to output stored procedure result



Hello

An error occurred while I try to create existing table. My code is as
below (all code are in a file called testing)

use database_name
go
CREATE EXISTING TABLE temp_tablename
(
customer_account_id char(11),
currency char(3),
amount money,
allocated_amount money,
last_update datetime,
last_update_user char(3)
)
external procedure
at "servername.database_name.owner_name.stored_procedure_name"

SELECT * FROM temp_tablename
go

When I run the above file, I type:
isql -Uusername -Sservername -Ppassword < testing

After that an error occured, "Msg 11204, Level 16, State 2:
Server 'servername', Line 15:
There is an error in the syntax of the object definition
'temp_tablename'

I am a newbie on sybase and unix. Could you please give me some
suggestions on the coding?

Beside this, do I use create table instead of create existing table?
The stored procedure just create temp table, right? After the stored
procedure session expire, the temp table will be gone, right?

Thanks

BJ

Rob Verschoor 寫道:

> All ASE documentation is available online at
> http://sybooks.sybase.com/as.html . For 'create proxy table', go here:
> http://tinyurl.com/c25cj .
>
> HTH,
>
> Rob
> -------------------------------------------------------------
> Rob Verschoor
>
> Certified Sybase Professional DBA for ASE 12.5/12.0/11.5/11.0
> and Replication Server 12.5 / TeamSybase
>
> Author of Sybase books (order online at www.sypron.nl/shop):
> "Tips, Tricks & Recipes for Sybase ASE"
> "The Complete Sybase Replication Server Quick Reference Guide"
> "The Complete Sybase ASE Quick Reference Guide"
>
> mailto:rob@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> http://www.sypron.nl
> Sypron B.V., P.O.Box 10695, 2501HR Den Haag, The Netherlands
> -------------------------------------------------------------
>
> "BJ" <bonnie.tangyn@xxxxxxxxx> wrote in message
> news:1123948457.592184.287230@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Where can I find the reference manual about creating existing table?
> Would you mind to give me some examples on creating the table?
>
> Thanks
>
> BJ
>
>
> Michael Peppler ??:
>
> > On Fri, 12 Aug 2005 21:09:32 -0700, BJ wrote:
> >
> > > Hello all
> > >
> > > I can use bcp command to output database views to text file. My
> statement
> > > is:
> > > bcp database_name..viewname out output_filename.txt -Uusername
> > > -Sservername -Ppassword -c
> > >
> > > However, an error occurs when I use the same statment to output stored
> > > procedure result. I typed:
> > > bcp database_name..stored_procedure_name out output_filename.txt
> > > -Uusername -Sservername -Ppassword -c
> > >
> > > Could anyone give me some suggestions?
> >
> > You can probably create a proxy table that maps to the stored procedure,
> > and then bcp out from the proxy table. Take a look at the "create existing
> > table" command in the reference manual.
> >
> > Michael
> > --
> > Michael Peppler [TeamSybase] mpeppler@xxxxxxxxxxx -
> http://www.peppler.org/
> > Sybase DBA/Developer
> > Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html

.



Relevant Pages

  • Recent updates at www.sypron.nl
    ... 'purple book' "The Complete Sybase ASE Quick Reference Guide" ... - "The Complete Sybase Replication Server Quick Reference Guide" ... Tricks & Recipes for Sybase ASE" ...
    (comp.databases.sybase)
  • Recent updates at www.sypron.nl
    ... If you're a DBA or developer for ASE or Replication Server, ... "The Complete Sybase Replication Server Quick Reference Guide" ...
    (comp.databases.sybase)
  • Re: Is it not allowed to load compressed backups from remote servers?
    ... Certified Sybase Professional DBA for ASE 12.5/12.0/11.5/11.0 ... "The Complete Sybase Replication Server Quick Reference Guide" ... "The Complete Sybase ASE Quick Reference Guide" ...
    (comp.databases.sybase)
  • Re: New column not recognized
    ... Certified Sybase Professional DBA for ASE 12.5/12.0/11.5/11.0 ... "The Complete Sybase Replication Server Quick Reference Guide" ... "The Complete Sybase ASE Quick Reference Guide" ... stored procedure also throws up "invalid column name error" ...
    (comp.databases.sybase)
  • Re: Negative @@rowcount
    ... Certified Sybase Professional DBA for ASE 12.5/12.0/11.5/11.0 ... "The Complete Sybase Replication Server Quick Reference Guide" ... "The Complete Sybase ASE Quick Reference Guide" ...
    (comp.databases.sybase)