August 28, 2018 at 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?
August 28, 2018 at 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
August 28, 2018 at 6:40 am
NikosV - Tuesday, August 28, 2018 1:13 AMI'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'?
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
August 28, 2018 at 6:47 am
Phil Parkin - Tuesday, August 28, 2018 6:40 AMNikosV - Tuesday, August 28, 2018 1:13 AMI'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.
August 28, 2018 at 6:48 am
rodjkidd - Tuesday, August 28, 2018 2:45 AMHi 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.
August 28, 2018 at 6:56 am
NikosV - Tuesday, August 28, 2018 6:47 AMPhil Parkin - Tuesday, August 28, 2018 6:40 AMPasting 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.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
August 28, 2018 at 8:57 am
Phil Parkin - Tuesday, August 28, 2018 6:56 AMNikosV - Tuesday, August 28, 2018 6:47 AMPhil Parkin - Tuesday, August 28, 2018 6:40 AMPasting 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.
August 29, 2018 at 12:34 pm
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