question

foram avatar image
foram asked

PRINT statement from DTS

Hi, I want the DTS package to output the PRINT statements from the procedure. I tried searching on that but did not get a solid method. Can anyone please help me on that?? -Foram
sql-server-2000dts
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Tim avatar image
Tim answered
When you say print you mean to physically send the result set to a printer or to output the result to a file?
3 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I haven't tried this. I know there is a logging tab in the DTS Package but that might be for auditing changes to the DTS or Error handling. PRINT statements within a stored procedure or other SQL Task may not reveal itself here. I would have to test that. If all else fails, you could change the PRINT statements to inserts into a logging table and reference that for your troubleshooting or monitoring. You could either include a datetime column to record the date and time the package ran, or just truncate the table at the beginning of the DTS. If I have time today I will test the logging tab in the DTS.
1 Like 1 ·
@TRAD It looks like the question is about viewing the output of the actual **print** statements from the proc, (the ones used to "debug" and can be viewed in the messages window with results to grid and results window with results to text).
0 Likes 0 ·
Trad, Sorry for the confusion I mean output the results to text file
0 Likes 0 ·
KenJ avatar image
KenJ answered
I haven't done DTS for awhile, but I seem to recall (correctly, I hope) that any PRINT statements output by stored procedures can be captured by the job step calling the DTS package. Just configure a log file for the job step, and the PRINT statements will be logged there, along with the rest of the console output from the package.
2 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@Ken: I have tried that but the logging associated with the step logs following info: DTSRun: Loading... DTSRun: Executing... DTSRun OnStart: DTSStep_DTSExecuteSQLTask_1 DTSRun OnFinish: DTSStep_DTSExecuteSQLTask_1 DTSRun: Package execution complete. I am talking about the logging set up from 'Advanced' tab in the step. Let me know if that is not what you are talking about.
0 Likes 0 ·
That is the logging I meant. So much for my recollection :)
0 Likes 0 ·
Milind Vaity avatar image
Milind Vaity answered
You will required to enable logging with the SSIS Log Provider for Text Files and set it up to log all the possible events. And you need to following code in events where you had provide log option byte[] emptyBytes = new byte[0]; string strData = "Test Output Data" Dts.Log(strData, 0, emptyBytes); For more information please refer http://msdn.microsoft.com/en-us/library/ms136131.aspx http://www.roelvanlisdonk.nl/?p=1855
1 comment
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@Milind: I am wanting to do this stuff in DTS and not SSIS.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.