SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Using xp_cmdshell


Using xp_cmdshell

Author
Message
RBarryYoung
RBarryYoung
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14600 Visits: 9518
Did you try the steps that I listed above?

-- RBarryYoung, (302)375-0451 blog: MovingSQL.com, Twitter: @RBarryYoung
Proactive Performance Solutions, Inc.
"Performance is our middle name."
Krushna
Krushna
Grasshopper
Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)

Group: General Forum Members
Points: 17 Visits: 33

1) Modify your PrintToPDFConsole.exe to always return to the console a detailed status description. If it failed, then it should return the error number, error message, line number, etc. AND if it succeeds (or thinks that it has), it should also say that: what it printed and to where. This is crucial to debugging any problems, because right now for instance you are getting nothing back and thus have no idea where the problem might be.


Yes, Now the exe got changed. I've added the message 'Printing Done' after the process start. And it can't say where the printing has done. Because the setting is there in the PDF Printer, not in the code.


2) Logon the the server's console (Workstation or Remote Desktop), open a DOS window and execute your PrintToPDFConsole command there. Debug any problems.


Here there is no problem. The message comes 'Printing Done'. Also, the printing process finishes. When the process is going on, I can see the operations and in the status bar, Printer logo and adobe pdf logo also there.


3) Next, still from a console logon, use SSMS (Management Studio) to connect to SQL Server, and from a query window run your sp_ExecuteSql command. Debug and/or report any problems back to us.


This gives the following output

Printing Done
NULL

But there is no printing process also no logo on the status bar.
And in the adobe pdf printer, the status is 'spooling' and this status remains till it has not been canceled.
and the owner is 'SYSTEM' here.


4) Now, still from the console, run your stored procedure and debug and/or report any problems back to us.


This gives result same as option 3.

5) Now open a query window from desktop and execute the sp_ExecuteSql command again. Debug and/or report any problems back to us.


This gives result same as option 3.


6) Finally run your stored procedure as you intend it to run. Debug and/or report any problems back to us.


This gives result same as option 3.
RBarryYoung
RBarryYoung
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14600 Visits: 9518
OK Krusna, thanks for the detailed reply, it was very helpful.

Currently, my suspicion is that either the "PDF Printer" settings as user specific and have not been set for whatever user your SQL Server uses for sp_ExecuteSql, or else the default printer has not been set for that user.

I think that you will need to check with the makers of your PDF Printer to see have you can set these from the command line or else how to configure them for another use in advance.

-- RBarryYoung, (302)375-0451 blog: MovingSQL.com, Twitter: @RBarryYoung
Proactive Performance Solutions, Inc.
"Performance is our middle name."
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search