[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 764
  • Last Modified:

Can I send a dataset from SQL Server to a printer

Can I send a dataset to a printer from a trigger or from a store procedure?  Can it be a specific printer or a default printer?
0
DavidLumpkin
Asked:
DavidLumpkin
  • 3
  • 2
  • 2
1 Solution
 
nemws1Commented:
In short.  No.  You would have to have the trigger/stored procedure insert data into a table and then query that table and print the output (with either SSIS or perhaps just SQLCMD).  SQL is a datastore, not an interactive program. :)
0
 
DavidLumpkinAuthor Commented:
I would have to disagree, and say that MS SQL Server is a lot more than a datastore. For instance, I have triggers and automated processes that format and send data as emails.  I've never, however, sent any data directly to a printer. I was hoping someone could provide an innovative tip. An Outlook rule could send an email directly to the printer, but I would have to get rid of the headers.
0
 
Russell FoxDatabase DeveloperCommented:
If I were faced with this I would create a report that outputs a simple grid (no headers), then an SSRS subscription to generate it to a file share, and then get some PowerShell script to watch that folder for new files, send them to the printer, and then delete them.  Here is someone doing the same thing.
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
nemws1Commented:
Although SQL Server can send e-mail, it cannot send results to a printer without a client-side application.  If there was some way of formatting the data nicely and then connecting to port 9100 (the default raw input port) on a printer, it would be possible, but SQL Server does not provide this.  Any other solution would require something client-side, which IMO, is no longer a SQL Server question, but a question about how to print data from an application.  Furthermore, you had ask specifically about printing *from* a trigger or stored proc, which SQL Server does not do.  You certainly *can* do some action to cause the trigger to be fired or call the proc from a client script and then print the output from that, but again, that's client-side, not server side.  Hope this helps/clears up things. :)
0
 
DavidLumpkinAuthor Commented:
Thanks.  This makes sense.  I'm looking for an end result and you provided a suggestion.
0
 
Russell FoxDatabase DeveloperCommented:
Sorry it's not easier. I added a suggestion on Microsoft Connect, so please give it an upvote to let them know we want this functionality built-in.
0
 
DavidLumpkinAuthor Commented:
Thanks.  I voted.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now