Tuesday, March 27, 2012

calling stored proc. from bcp

here's what I'm trying:
create procedure querytotext
as
select * from tablename
create function querytotext()
returns tables
as
return select * from tablename
bcp 'querytotext queryout filename.txt
bcp 'select querytotext()' queryout filename.txt
None of them working. bcp is calling neither stored procedure nor function.
Is it the limitation of bcp?Hi
Using double quotes around the query will help along with specifying the
database name for the procedure
bcp "EXEC mydb..querytotext" queryout filename.txt -T-c
John
try something like:
BCP "
"Raj" wrote:

> here's what I'm trying:
> create procedure querytotext
> as
> select * from tablename
> create function querytotext()
> returns tables
> as
> return select * from tablename
> bcp 'querytotext queryout filename.txt
> bcp 'select querytotext()' queryout filename.txt
> None of them working. bcp is calling neither stored procedure nor function
.
> Is it the limitation of bcp?
>
>

No comments:

Post a Comment