Hello,

  So I have been banging my head against a wall it seems because I have
been trying to automate the database build and deployment process for
our software.  The goal I have is using ANT and the sql task, to execute
an existing .sql file that was developed and placed in SVN.  I am having
an issue that when I execute the scripts using the ant SQL task, it does
not give me the results for the sql statement PRINT.  It just seems to
ignore it and not give me the message in the output.  All I get is "0
rows affected".  This is frustrating because I can't seem to get ANT to
give me the message.  The print statements contain information that is
good for logging what the results of the script.  

 

The manual process has been to just run the scripts using enterprise
manager and copy the results into a file and just save the file.  If I
didn't need this to run on a unix machine and connecting to MS-SQL
databases I would be using something like sqlplus or the sqlcmd tool on
windows.  But I would like to use ANT to do all the execution of the
scripts.  Any suggestions?  Is there a better solution out there? 

 

Some of my digging into the problem is with the print statement itself
and how ANT interprets the return codes.  So I think.  But I can't seem
to get that information out of ANT either.  This is what the MSDN site
says about the print statement....

 

"SQLSTATE is set to 01000, the native error is set to 0, and the error
message string is set to the character string specified in the PRINT
statement. The string is returned to the message handler callback
function in DB-Library applications."

http://msdn2.microsoft.com/en-us/library/ms190715.aspx

 

 

Nothing I have searched and searched for something related to this and
found nothing so far.  Can anybody help? 

 

I had thoughts that it might be that I needed a custom logger using
log4j...but I don't understand that enough to know if that is the path
to take.

 

Here is an example of a simple script that will illustrate what I am
trying to do....

 

PRINT 'This is a message to signify that a select statement is going to
be run:'

SELECT * FROM SomeTable

 

Thanks,

-nathan

Reply via email to