Question
· Feb 4, 2016

How to export SQL errors to a text file?

Hi,

Do you know how to export SQL errors to a text file from a terminal session in Caché?

Thanks

Discussion (3)0
Log in or sign up to continue

Hi Blaise. There is query ErrorLog in %CSP.UI.System.BackgroundTask class so you can print errors like follows:

USER>do ##class(%ResultSet).RunQuery("%CSP.UI.System.BackgroundTask","ErrorLog",3932)

3932 here is task id.

And print errors to file:

USER>set file="c:\temp\sqlerrors.txt"
 
USER>open file:"NW":5
 
USER>use file do ##class(%ResultSet).RunQuery("%CSP.UI.System.BackgroundTask","ErrorLog",3932)
 
USER>close file

Notice that %CSP.UI.System.BackgroundTask is marked for internal use only.