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?
DavidLumpkinAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nemws1Database AdministratorCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

nemws1Database AdministratorCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.