August 17, 2012 at 1:42 pm
anthony.green (8/17/2012)
run query in ssms, results to grid, right click top left hand blank thing to select the whole result set including headers, then right click, save results as
But then he has the same problem. In fact, I think this is what he as doing originally when they told him it's not a "true" csv. It's not delimited. It's a fixed-width file. Or it's tab-delimited, I forget which.
In the Export Wizard, you need to choose Flat File as your destination.
August 20, 2012 at 1:47 am
Scott D. Jacobson (8/17/2012)
anthony.green (8/17/2012)
run query in ssms, results to grid, right click top left hand blank thing to select the whole result set including headers, then right click, save results asBut then he has the same problem. In fact, I think this is what he as doing originally when they told him it's not a "true" csv. It's not delimited. It's a fixed-width file. Or it's tab-delimited, I forget which.
In the Export Wizard, you need to choose Flat File as your destination.
Import/Export wizard does like temp tables.
If you export to the query to file then you have to save it as a rpt file or add comma's in between each column to export in a csv fashion.
You can run query to grid, click the top left hand gray box, then you are given, copy, copy with headers etc, one option is to save results as, and it allows you to save as a CSV.
August 20, 2012 at 7:42 am
anthony.green (8/20/2012)
Scott D. Jacobson (8/17/2012)
anthony.green (8/17/2012)
run query in ssms, results to grid, right click top left hand blank thing to select the whole result set including headers, then right click, save results asBut then he has the same problem. In fact, I think this is what he as doing originally when they told him it's not a "true" csv. It's not delimited. It's a fixed-width file. Or it's tab-delimited, I forget which.
In the Export Wizard, you need to choose Flat File as your destination.
Import/Export wizard does like temp tables.
If you export to the query to file then you have to save it as a rpt file or add comma's in between each column to export in a csv fashion.
You can run query to grid, click the top left hand gray box, then you are given, copy, copy with headers etc, one option is to save results as, and it allows you to save as a CSV.
I'm not sure I follow you. "Results to file" in a query window does indeed output to a .rpt file. The other method you mentioned; clicking in the corner of the Results grid and highlighting everything then right-clicking and select Save Resutls As allows you to output a CSV.
The Wizard also allows you to save to CSV if you choose Flat File as your destination and Delimited. The wizard has the added benefit of being able to save the entire thing as SSIS for later use.
August 20, 2012 at 7:50 am
Scott D. Jacobson (8/20/2012)
anthony.green (8/20/2012)
Scott D. Jacobson (8/17/2012)
anthony.green (8/17/2012)
run query in ssms, results to grid, right click top left hand blank thing to select the whole result set including headers, then right click, save results asBut then he has the same problem. In fact, I think this is what he as doing originally when they told him it's not a "true" csv. It's not delimited. It's a fixed-width file. Or it's tab-delimited, I forget which.
In the Export Wizard, you need to choose Flat File as your destination.
Import/Export wizard does like temp tables.
If you export to the query to file then you have to save it as a rpt file or add comma's in between each column to export in a csv fashion.
You can run query to grid, click the top left hand gray box, then you are given, copy, copy with headers etc, one option is to save results as, and it allows you to save as a CSV.
I'm not sure I follow you. "Results to file" in a query window does indeed output to a .rpt file. The other method you mentioned; clicking in the corner of the Results grid and highlighting everything then right-clicking and select Save Resutls As allows you to output a CSV.
The Wizard also allows you to save to CSV if you choose Flat File as your destination and Delimited. The wizard has the added benefit of being able to save the entire thing as SSIS for later use.
Running through the wizard using # temp tables results in invalid object errors, to the wizard will not suit the OP's requirements.
I have attached screenshots of how to to it via SSMS.
August 20, 2012 at 7:59 am
anthony.green (8/20/2012)
Scott D. Jacobson (8/20/2012)
anthony.green (8/20/2012)
Scott D. Jacobson (8/17/2012)
anthony.green (8/17/2012)
run query in ssms, results to grid, right click top left hand blank thing to select the whole result set including headers, then right click, save results asBut then he has the same problem. In fact, I think this is what he as doing originally when they told him it's not a "true" csv. It's not delimited. It's a fixed-width file. Or it's tab-delimited, I forget which.
In the Export Wizard, you need to choose Flat File as your destination.
Import/Export wizard does like temp tables.
If you export to the query to file then you have to save it as a rpt file or add comma's in between each column to export in a csv fashion.
You can run query to grid, click the top left hand gray box, then you are given, copy, copy with headers etc, one option is to save results as, and it allows you to save as a CSV.
I'm not sure I follow you. "Results to file" in a query window does indeed output to a .rpt file. The other method you mentioned; clicking in the corner of the Results grid and highlighting everything then right-clicking and select Save Resutls As allows you to output a CSV.
The Wizard also allows you to save to CSV if you choose Flat File as your destination and Delimited. The wizard has the added benefit of being able to save the entire thing as SSIS for later use.
Running through the wizard using # temp tables results in invalid object errors, to the wizard will not suit the OP's requirements.
I have attached screenshots of how to to it via SSMS.
Ah that's what I was missing. Should have gone back an re-read the query. Thanks for clearing that up Anthony.
August 20, 2012 at 10:20 am
anthony.green (8/17/2012)
run query in ssms, results to grid, right click top left hand blank thing to select the whole result set including headers, then right click, save results as
Thanks for Your Help
Problem solve
I run Query in SSMS, results to Text(set output format to comma Delimited in query option under Text). copy the results and save that results to .csv format and it works.
Viewing 6 posts - 16 through 20 (of 20 total)
You must be logged in to reply to this topic. Login to reply