I'm trying to find the fastest way to actually get SQL Server query results to Excel, with the least possible trouble.

Frankly the query > text is a bit annoying, there's a "9393 results found" at the bottom. There's also a character limit of 8,000.

The query > grid looks nice, but it either exports (copy>paste) with no delimiter whatsoever, or defaults to commas with (save as) - which doesn't work for data containing natural commas.

Is there any way to do grid export > with semicolons or custom deliminator?

Not sure why SQL Server likes to make this as annoying as possible, there are many MySQL clients that make this simple.

  • 3
    CTRL-A, CTRL-C then CTRL-V into Excel doesn't work? Or are you looking for something programatical? – Nic Nov 2 '16 at 21:45
  • If you don't like SSMS, then why don't you use a different SQL client? – a_horse_with_no_name Nov 2 '16 at 22:04
  • Just out of curiosity, how many columns does your query return, and have you written the query so a string of text is returned for each row with delimiters in it? – Stephen Falken Nov 3 '16 at 7:17
  • copy paste doesn't work into Excel from the grid, there are no deliminators at all, not even spaces. I might dump SSMS, wasn't aware their were multiple decent clients for MS SQL Server. The query itself doesn't contain deliminators, but actually, I guess this would be a valid idea. Not sure why I didn't think of it – user45867 Nov 3 '16 at 22:04

The "9393 results found" message can be removed by putting SET NOCOUNT ON before your query.

I'm using SSMS 2016 and I see the option to use a custom delimiter for Results to Text by going to Tools > Options, then looking under Query Results > SQL Server > Results to Text

The "Output format" dropdown has a custom delimiter option.

If you are committed to using Results to Grid, then you might have to edit your SELECT columns, perhaps using QUOTENAME() or another method.

| improve this answer | |
  • The grid one just looks nicer and has a better design for viewing results; hate to switch between text and grid depending on whether I feel like exporting something. Also the grid one appears to be able to "hold" more data ... there's an 8000 character limit or so for the text one. I'm not sure if that's per cell or just per row. Rare but I have survey feedback that is sometimes paragraphs long is a text field. Eh – user45867 Nov 3 '16 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.