Easiest way to show client query results

  • I'm trying to figure out how I can basically print my query results and give them to the user before going onto the next stage of building the actual report.

    This would help a great deal because it would mean getting immediate feedback from the client and I'd know of any discrepancies or errors prior to creating the report. I cannot e-mail, all I can do is print. Pasting the results into Notepad or Excel destroys the indentation.

    I'm sure I'm not the first person to need this. What's available to us here? Can something be done through SSMS? Some sort of decent export?

  • Hi one thing you could try is;
    change the output in SSMS to text (Query --> Results To --> results to Text) or Ctl-T
    Then under query options in the results options, change the output format to Tab Delimited
    (Query --> Query options..)
    I've used that in the past to keep the the formatting for Excel. Sometimes its a tab or so out with notepad.

    Cheers,

    Rodney

  • NikosV - Tuesday, August 28, 2018 1:13 AM

    I'm trying to figure out how I can basically print my query results and give them to the user before going onto the next stage of building the actual report.

    This would help a great deal because it would mean getting immediate feedback from the client and I'd know of any discrepancies or errors prior to creating the report. I cannot e-mail, all I can do is print. Pasting the results into Notepad or Excel destroys the indentation.

    I'm sure I'm not the first person to need this. What's available to us here? Can something be done through SSMS? Some sort of decent export?

    Pasting into Excel works for me. Can you give an example of your indentation being 'destroyed'?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Phil Parkin - Tuesday, August 28, 2018 6:40 AM

    NikosV - Tuesday, August 28, 2018 1:13 AM

    I'm trying to figure out how I can basically print my query results and give them to the user before going onto the next stage of building the actual report.

    This would help a great deal because it would mean getting immediate feedback from the client and I'd know of any discrepancies or errors prior to creating the report. I cannot e-mail, all I can do is print. Pasting the results into Notepad or Excel destroys the indentation.

    I'm sure I'm not the first person to need this. What's available to us here? Can something be done through SSMS? Some sort of decent export?

    Pasting into Excel works for me. Can you give an example of your indentation being 'destroyed'?

    It's really bad Phil. However, I did find that keeping the results as a grid, highlighting the columns then right clicking the cells and choosing 'Copy With Headers' pastes into Excel quite nicely. I presume that's what you meant.

    Can't show the indentation now because I'm not at the work PC but pasting into Excel looks ok for now so I'll do that.

  • rodjkidd - Tuesday, August 28, 2018 2:45 AM

    Hi one thing you could try is;
    change the output in SSMS to text (Query --> Results To --> results to Text) or Ctl-T
    Then under query options in the results options, change the output format to Tab Delimited
    (Query --> Query options..)
    I've used that in the past to keep the the formatting for Excel. Sometimes its a tab or so out with notepad.

    Cheers,

    Rodney

    Sounds good I'll try it thanks.

  • NikosV - Tuesday, August 28, 2018 6:47 AM

    Phil Parkin - Tuesday, August 28, 2018 6:40 AM

    Pasting into Excel works for me. Can you give an example of your indentation being 'destroyed'?

    It's really bad Phil. However, I did find that keeping the results as a grid, highlighting the columns then right clicking the cells and choosing 'Copy With Headers' pastes into Excel quite nicely. I presume that's what you meant.

    That is what I meant, though you do not need to select the columns individually – instead just click on the plain grey cell to the left of the column headings (the row number column). This selects all columns. Then CTRL-SHIFT-C to copy data with column headings & paste into Excel.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Phil Parkin - Tuesday, August 28, 2018 6:56 AM

    NikosV - Tuesday, August 28, 2018 6:47 AM

    Phil Parkin - Tuesday, August 28, 2018 6:40 AM

    Pasting into Excel works for me. Can you give an example of your indentation being 'destroyed'?

    It's really bad Phil. However, I did find that keeping the results as a grid, highlighting the columns then right clicking the cells and choosing 'Copy With Headers' pastes into Excel quite nicely. I presume that's what you meant.

    That is what I meant, though you do not need to select the columns individually – instead just click on the plain grey cell to the left of the column headings (the row number column). This selects all columns. Then CTRL-SHIFT-C to copy data with column headings & paste into Excel.

    Brilliant thanks Phil.

  • I wanted to point out another alternative.  Use Excel to query SQL.
    I don't really have time to give you step by step instructions, but there are plenty of how-to articles that you can google to explain every step.
    The main problem I had was security, luckily we have an AD Group called SQL Readers.
    Just be sure that you grant select or execute permissions to every object you are querying.
    Took me an hour to figure out and now the help desk doesn't need me to access the backend every time they encounter a problem with our old document management system, mainly file restores.
    This is a process that will eventually be obsolete as we just converted to new document management software and it is used for getting locations from our old system.
    Normally we develop reports in SSRS and set-up subscriptions for end user's.

Viewing 8 posts - 1 through 7 (of 7 total)

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