How do we generate csv with custom data?

  • It might be an old question but wanted to see, if we have any latest techniques (other than bcp).

    SELECT Field1, Field2 FROM MyTable

    If I want to export the output of the above query to a csv on a network folder, what would you suggest? I would like to avoid usage of SSIS package or BCP (as user needs to get additional rights to execute bcp)

    Thanks

  • the end user is going to be using TSQL to send files to disk, or is this some sort of automated process that you are envisioning?

    in my case, i have a suite of CLR stored procedures that do a lot of exporting to disk for various formats, and then a classic example would be a signed procedure that a normal user can call, that sends a query to the CLR, which creates the file, which can then either be emailed or browsed to if it was copied to a share the user has access to.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • I'm planning to create a stored procedure which dumps to a file in the specified path. It will be scheduled as job on the server.

  • Right now, I have created SP and used sqlcmd to dump to file. But, when I open in text file, it shows up lots of empty space as it takes some width on each column like below.

    "Text1" ,"Text2"

    "ttt" ,"T"

    I'm still not sure if this is the best way!!

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

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