Exporting data from SQL Server...

  • Hi all,

    I am trying to do what I thought would be a breeze, and is ending up taking way too much time and brain processing!:crazy:

    That is: programmatically (using a stored procedure, UDF, whatever SQL means) export the contents of a table to a comma-delimited file (with column optionally surrounded by double-quotes.) I also wish this export to be run by regular users NOT exclusively by a DBA with sa rights.

    I have tried:

    1. a stored procedure with a bcp command. Two problems here:

    - must be run as a user with sa rights (I spent an inordinate amount of time trying various proposed 'solutions' that create db user aliases so that xp_CmdShell can be run, to eventually give up when none of them worked.)

    - exports the file as a CSV but I could find no option to optionally surround the columns with double-quotes (option available in the DTS wizard...)

    2. Creating and saving a DTS package, hoping I'd get a file which I could 'run' (like something in T-SQL). I got a file alright but other than load it back into the wizard, I'm not sure what else to do with it.

    I'd welcome any idea.

    Desperately seeking data!

    Thanks in advance

    Pierrick

    Kind regards
    Pierrick

  • Pierrick

    You can use the dtsrun utility to run your DTS package.

    John

  • Thanks for your suggestion John.

    I'll look up the dtsrun command.

    Kind regards
    Pierrick

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

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