simple question... can bcp use a stored procedure?

  • suppose i create an sp that is essentially just

    a select statement.

    shouldn't i be able to put that into a bcp as any usual query?

    example:

    bcp "sp_query master" queryout C:\myfile.bcp

    i put this under a job, and it runs endlessly without actually creating any

    files, or anything. am i doing some thing wrong?

    _________________________

  • It'll work. Although unless your login connects you to the proper database, you'll have to specify the database name in the statement.

    bcp "exec [dbname].[owner].sp_query @myparam='Hello'" queryout myfile.txt -c -T

  • Try running your command at the prompt first. My guess is that since you did not provide either the -n or -c parameter to tell bcp the format of the outbcp is being invoked interactively in order to create a format file. The key word is 'interactively'. The job never comes back since it is waiting for keyboard input which cannot occur in a scheduled task which is batch ! Additionally the in|out keyword which defined the direction of the bcp process is missing as well.

    RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."

  • excellent point...

    _________________________

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply