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.
Author |
Topic |
yonabout
Posting Yak Master
112 Posts |
Posted - 2006-10-05 : 09:00:35
|
Hi,Anyone know a quick way to send variables to a text file somewhere?I'm trying to debug a stored procedure, and I just want to know what a couple of the variables are at various points through it.I don't want everything that you get using a trace or a transaction log.I have been using print to get me the bits that I need out, but the procedure I'm trying to debug now is fired as a SQL Server Agent Job when rows are updated in a table. Before you ask, I've got no idea why it isn't run as a trigger, but I don't want to change it before I've figured out what its doing.Can you write to a text file from a procedure?If I stick print lines in to the sproc, can I see them when SQL Server Agent fires it?Any ideas?Thanks in advanceYonabout |
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-10-05 : 09:18:05
|
print statements should turn up in the job history but there is limited sapce.You can create a trace statement and insert into it from the sp.Otherwise xp_cmdshell with an echo statement is probably easiest to write to a text file.There are a number of reasons it might be run as a job rather than a trigger.The trigger would block the rows and might hld uyp other processes.It might be doing something on another connection (bcp, ...) which would be blocked by the firing statement.A trigger failure would roll back the firing statement whereas the job won't.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
yonabout
Posting Yak Master
112 Posts |
Posted - 2006-10-05 : 09:59:04
|
Hi, Just tried the sp chirag sent me a link to and it works great.Thanks for your hep.CheersYonabout |
|
|
|
|
|