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 2005 Forums
 Transact-SQL (2005)
 Writing a log file

Author  Topic 

Sarakumar
Posting Yak Master

108 Posts

Posted - 2009-06-29 : 02:27:48
Hai, im using sql 2000. i would like to write a log file for one of my SP. Log file shd be generated from sql server only..how can i do that..
exmaple, i have sp, to update 10 rows. so after each row got updated , i need to write into a file saying that
1 row updated.
how can i do that??

asgast
Posting Yak Master

149 Posts

Posted - 2009-06-29 : 05:14:10
1 this is sql 2005 forum :)

in sql 2005 I would think of 2 options to write logs from sp
create a new table and write every update to it, as i understand you don't want this

use cmdshell and write our info to a file should be something like this

declare @l varchar(max)
SET @l= ''+CAST(@@rowcount as varchar) rows updated' >> c:\sp.log '
EXEC xp_cmdshell @l, no_output

you can modify the string to be written to suite our needs

I have tested this solution in sql 2005, I'm not familiar enough with 2000 to give you a solution
Go to Top of Page
   

- Advertisement -