This is a discussion on Printing query results from sp within the SQL Server forums, part of the Microsoft SQL Server category; --> Is there any way to send the results of a query executed within a stored procedure to the default ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Is there any way to send the results of a query executed within a stored procedure to the default windows printer, or even to a text file? (I thinking of something similar to Oracle's DBMS_OUTPUT, or UTL_FILE commands.)? I want the query to run unattended, but send the results directly to the printer. Thanks |
| |||
| Hi to copy the result to a flat-file, u can use this: declare @str varchar(255) SET @str = 'isql -Q"select * from <tablename>" -E -oc:\file.fil' exec master..xp_cmdshell @str best Regards, Chandra http://groups.msn.com/SQLResource/ http://chanduas.blogspot.com/ --------------------------------------- *** Sent via Developersdex http://www.developersdex.com *** |
| |||
| There's no easy way to send the results to a printer, but you can use osql.exe or bcp.exe to get the results of a query into a text file - see Books Online for the details. You could then send the text file to a printer with an external script of some sort. Simon |
| ||||
| Thanks Chandra and Simon... Guess I'll set up a job to run an external app that can query the data and send the results to the printer. "Par-breaker" <tkestell@comcast.net> wrote in message news:taudnRQdI_L7WALfRVn-iw@comcast.com... > Is there any way to send the results of a query executed within a stored > procedure to the default windows printer, or even to a text file? (I > thinking of something similar to Oracle's DBMS_OUTPUT, or UTL_FILE > commands.)? > > I want the query to run unattended, but send the results directly to the > printer. > > Thanks > > |
| Thread Tools | |
| Display Modes | |
|
|