bcp problem in stored procedure  
Author Message
AirCooledNut





PostPosted: Thu Jan 25 11:31:33 CST 2007 Top

SQL Server Developer >> bcp problem in stored procedure

I am trying to use bcp to output a query to a flat file but when I call
bcp it hangs and never comes back.

I create a table in my store procedure into which I store the results
that I will later try to output using bcp.
CREATE TABLE REM3_3.dbo.ResultTbl
{
.....stuff
}

I then populate the table call the query with the following code:


queryout -c -T'


(it hangs in the Exec call and never comes back)

which is followed by
DROP TABLE REM3_3.dbo.ResultTbl

I also tried using a global temp table but it also hangs (but in a
different spot.


Any ideas?

Thanks!

SQL Server77  
 
 
kevin





PostPosted: Thu Jan 25 11:31:33 CST 2007 Top

SQL Server Developer >> bcp problem in stored procedure Well after doing a little more searching in this group...... I added a
COMMIT statement before the bcp call and it seems to cure all my woes.
After several hours of fighting with this....... [sound of head beating
desk].


> I am trying to use bcp to output a query to a flat file but when I call
> bcp it hangs and never comes back.
>
> I create a table in my store procedure into which I store the results
> that I will later try to output using bcp.
> CREATE TABLE REM3_3.dbo.ResultTbl
> {
> .....stuff
>
> }I then populate the table call the query with the following code:
>

> queryout -c -T'

>
> (it hangs in the Exec call and never comes back)
>
> which is followed by
> DROP TABLE REM3_3.dbo.ResultTbl
>
> I also tried using a global temp table but it also hangs (but in a
> different spot.
>
> Any ideas?
>
> Thanks!

 
 
AlterEgo





PostPosted: Thu Jan 25 11:19:18 CST 2007 Top

SQL Server Developer >> bcp problem in stored procedure Kevin,

I don't know why it would hang, but you haven't specified a filename in your
example. Is that the problem?

-- Bill



>I am trying to use bcp to output a query to a flat file but when I call
> bcp it hangs and never comes back.
>
> I create a table in my store procedure into which I store the results
> that I will later try to output using bcp.
> CREATE TABLE REM3_3.dbo.ResultTbl
> {
> .....stuff
> }
>
> I then populate the table call the query with the following code:
>

> queryout -c -T'

>
> (it hangs in the Exec call and never comes back)
>
> which is followed by
> DROP TABLE REM3_3.dbo.ResultTbl
>
> I also tried using a global temp table but it also hangs (but in a
> different spot.
>
>
> Any ideas?
>
> Thanks!
>


 
 
VernRabe





PostPosted: Thu Jan 25 11:36:11 CST 2007 Top

SQL Server Developer >> bcp problem in stored procedure Aren't you missing the destination file name?

Vern Rabe



> I am trying to use bcp to output a query to a flat file but when I call
> bcp it hangs and never comes back.
>
> I create a table in my store procedure into which I store the results
> that I will later try to output using bcp.
> CREATE TABLE REM3_3.dbo.ResultTbl
> {
> .....stuff
> }
>
> I then populate the table call the query with the following code:
>

> queryout -c -T'

>
> (it hangs in the Exec call and never comes back)
>
> which is followed by
> DROP TABLE REM3_3.dbo.ResultTbl
>
> I also tried using a global temp table but it also hangs (but in a
> different spot.
>
>
> Any ideas?
>
> Thanks!
>
>
 
 
kevin





PostPosted: Thu Jan 25 12:03:09 CST 2007 Top

SQL Server Developer >> bcp problem in stored procedure woops had the filename in the procedure but forgot to add it to the
code example. The commit statement did solve my problem and now I
changed the table to a temp global and it is working just fine.

Thanks!



> Aren't you missing the destination file name?
>
> Vern Rabe
>

> > I am trying to use bcp to output a query to a flat file but when I call
> > bcp it hangs and never comes back.
>
> > I create a table in my store procedure into which I store the results
> > that I will later try to output using bcp.
> > CREATE TABLE REM3_3.dbo.ResultTbl
> > {
> > .....stuff
> > }
>
> > I then populate the table call the query with the following code:
>

> > queryout -c -T'

>
> > (it hangs in the Exec call and never comes back)
>
> > which is followed by
> > DROP TABLE REM3_3.dbo.ResultTbl
>
> > I also tried using a global temp table but it also hangs (but in a
> > different spot.
>
> > Any ideas?
>
> > Thanks!