I need to be able to print a message to the screen in query analyser at the beginning of a stored proc. The message however only appears once the batch has finished running. How can I ensure that the message appears as soon as the procedure is executed ?
There is nothing you can actually do to force SQL server to print a message any quicker. Basically, it will do all print to screens to a buffer, and only when the buffer is full, will it actually print the details to screen.
This is very frustrating, but the only way around it is to run any stored procs from ISQL (if you have that installed). Then prints will be returned as soon as they are processed by the system.
ISQL is a command line program that runs from either a DOS or a Unix command line.
Its format is
ISQL -Uuser_name -Sserver_name -Ppassword
You can then use any standard SQL commands, remembering to enter "go" as a command to execute your statements, so to run a stored proc from the command line will be:
EXEC stored_procedure
GO
ISQL is very useful, as it sends commands directly to and from the database server, instead of through any middle applications, such as query analyzer, so processing times are quicker. It is, however, impossible to edit in ISQL, so writing programs there is still not recommended.
You could also try an internet search on ISQL for more information.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.