Saturday, July 23, 2011

Write Log Files - Sybase

Writing Logs - Text Files using Sybase

If you want to write to a Log file using Sybase use the following
code. Here the log file is not overwritten - it is appended with the
existing text. As the existing text is stored in a variable and
rewritten to the file there will be a gradual slowdown in performance

BEGIN
Declare sbuffer long varchar;
Declare sText long varchar;
Declare iRet integer;
Set sbuffer = xp_read_file('c:\temp\sample.sql');
Set sText = '\n';
Set sText = sText || 'Writing Text @ ' || Now(*);
Set iRet = xp_write_file('c:\temp\sample.sql', sbuffer || sText);
END;

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Deep's | Bloggerized by Deep - Deep's Templates | ElearSQL-Server