Discussion:
how to use bcp command to output stored procedure result
(too old to reply)
BJ
2005-08-13 04:09:32 UTC
Permalink
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?

Thanks

BJ
Michael Peppler
2005-08-13 08:27:57 UTC
Permalink
Post by BJ
Hello all
I can use bcp command to output database views to text file. My statement
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
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] ***@peppler.org - http://www.peppler.org/
Sybase DBA/Developer
Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html
BJ
2005-08-13 15:54:17 UTC
Permalink
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 寫道:
Post by Michael Peppler
Post by BJ
Hello all
I can use bcp command to output database views to text file. My statement
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
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
--
Sybase DBA/Developer
Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html
Rob Verschoor
2005-08-13 16:31:51 UTC
Permalink
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:***@YOUR.SPAM.sypron.nl.NOT.FOR.ME
http://www.sypron.nl
Sypron B.V., P.O.Box 10695, 2501HR Den Haag, The Netherlands
-------------------------------------------------------------

"BJ" <***@gmail.com> wrote in message news:***@g44g2000cwa.googlegroups.com...
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
Post by Michael Peppler
Post by BJ
Hello all
I can use bcp command to output database views to text file. My statement
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
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
--
http://www.peppler.org/
Post by Michael Peppler
Sybase DBA/Developer
Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html
BJ
2005-08-15 10:39:01 UTC
Permalink
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 寫道:
Post by Rob Verschoor
All ASE documentation is available online at
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
"Tips, Tricks & Recipes for Sybase ASE"
"The Complete Sybase Replication Server Quick Reference Guide"
"The Complete Sybase ASE Quick Reference Guide"
http://www.sypron.nl
Sypron B.V., P.O.Box 10695, 2501HR Den Haag, The Netherlands
-------------------------------------------------------------
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
Post by Michael Peppler
Post by BJ
Hello all
I can use bcp command to output database views to text file. My
statement
Post by Michael Peppler
Post by BJ
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
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
--
http://www.peppler.org/
Post by Michael Peppler
Sybase DBA/Developer
Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html
Loading...