editing SQL Server 2008 query output file in linux

  • I have someone that needs to be able to edit a file generated from a SQL Server query. The user has a non-windows machine running linux.

    What is the best way do do this? I previously ran the query and saved the results to a file and the user that tried to edit the file says that it looks like a binary file.

    Any thoughts?

  • There are some nuances I wont cover here but should work or at least get you started.

    To export a query from SQL Server to comma delimited CSV file

    1) Right-click on the database that houses the data you need and select Tasks > Export Data

    The SQL Server Import/Export wizard will open

    2) If you see a welcome screen click Next

    3) On the Choose Data Screen make sure the correct database shows up under "Database", for "Data Source" select 'SQL Server Naitive Client'; click Next

    4) On the Choose Destination Screen select Flat File for "Destination" and complete the following

    Enter a File location & name (e.g. C:\...\dataexport.csv)

    -- Locale & Code Page Defaults should be okay

    -- Format Delimited...

    Click Next

    5) On the Specify Table Copy or Query page select 'Write a query to specify...'; click Next.

    6) Paste your query in the Provide Source Query window. Click Parse to check your query. If its good click Next.

    7) On the Configure Flat File Destination page the defaults should be okay. Click Preview to check the resultset from your query. Click Next.

    8) On the next window make sure that 'Run Immediately' is checked. Click Next.

    9) Review the final window. If all looks good, click 'Finish'.

    I am not taking into consideration collation, language defaults, Unicode-YES/NO?, etc... Again, this should get you started.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • Thanks. I am all set.

  • NP. 🙂

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

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

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