Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to send query results to a network printer?

Author  Topic 

royc
Yak Posting Veteran

53 Posts

Posted - 2006-11-06 : 08:13:30
Hello,

I would like to send a certain query results to a network printer we have. How can I do it using built-in sp's or SQL configuration?

Thank you in advance,
Roy

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-11-06 : 09:08:09
save the query results to a file and print that?

i don't think there's a feature in sql server that lets you do this.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

royc
Yak Posting Veteran

53 Posts

Posted - 2006-11-06 : 09:26:20
To save to a file I know, but how do I print it automatically after the save?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-11-06 : 10:11:49
use xp_cmdshell to execute a command (or run any of program) to print the file


KH

Go to Top of Page

royc
Yak Posting Veteran

53 Posts

Posted - 2006-11-06 : 10:23:00
Assuming I have qalready saved the file, could you please show me a code example in order to send it for a network printer with the name "myPrinter"?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-11-06 : 10:25:26
http://www.ss64.com/nt/print.html



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-11-06 : 10:26:15
also what server are you using?
sql 2000 or 2005?




Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

royc
Yak Posting Veteran

53 Posts

Posted - 2006-11-06 : 10:30:55
We are planning to upgrade to sql 2005 but we are currently running on 2000.
Could you please give me code examples for both options?
If you don't have for both of them than I assume that 2000 is the relevant one at the moment.

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-11-06 : 10:40:01
i just asked becuse in 2005 you could create a CLR function or stored procedure for this.
example is in the link i posted.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

royc
Yak Posting Veteran

53 Posts

Posted - 2006-11-06 : 11:08:54
10X
BTW, What is a CLR function?
Go to Top of Page

royc
Yak Posting Veteran

53 Posts

Posted - 2006-11-06 : 11:14:46
I just found out that we could do it on 2005.
Could you please show me how to do it in 2005 using CLR function?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-11-06 : 11:15:14
CLR is common language runtime.
http://www.gotdotnet.com/team/clr/about_clr.aspx

sql server 2005 has the option to integrate .net 2.0 created assemblies as stored procedure,
functions, trigger, aggregates and user defined types.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

royc
Yak Posting Veteran

53 Posts

Posted - 2006-11-06 : 11:20:43
10X a lot for all your help!
Go to Top of Page

royc
Yak Posting Veteran

53 Posts

Posted - 2006-11-06 : 11:22:10
Do you have code example using CLR that will do the same as I would do using xp_cmdshell 'print...'?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-11-06 : 11:30:13
nope.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -