 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
Suppress PRINT |
|
Is there a way to suppress PRINT and/or RAISERROR when executing a snippet so that it does not show the Messages window?
|
|
Tue Jul 17, 2012 5:29 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
I'm afraid I don't know a workaround for suppressing PRINT and other types of SQL Server returned warnings and informational messages. I've checked connection settings for SQL Server ADO.NET and so far haven't found specific parameters that can make non-result-set outputs to be ignored at the server or driver level.
|
|
Tue Jul 17, 2012 9:33 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
I haven't found a solution for that either, but that was not what I meant to ask. I've created a few $$...$$ snippet that generate some sql code and they use built-in stored procedures like sp_helpconstraint to gather some information into a table variable that will be used in the data transformation and code generation process. Now sp_helpconstraint and many others as well developed the bad habit of raising errors or simply printing messages when there's something missing, even though it might not be an actual error. Eg. sp_helpconstraint uses
 |
 |
raiserror(15470,-1,-1, 'whatever_object') |
when the object is a table that is not referenced by a foreign key . This in turn results in SA showing the Messages window (besides putting the generated code into the editor). Built-in procedures tend to print random things I've already taken care of (or don't care at all) and the resulting Messages window is obstructing working area. I know it's easy to remove it but it becomes wearisome after a while.
Is it possible to suppress this raiserorr in SA by explicitly (or using a setting or something) telling SA that I don't want to see the Messages window regardless it's content? In case it isn't would you consider adding a switch or an option to $$...$$ macro to implement Messages window suppression feature, please?
|
|
Thu Jul 19, 2012 4:12 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Thanks for clarifications, I see it's a bitt different issue. To your last question, I will check with the development team, as I'm not sure what's involved in the processing of snippets code and how deeply it is integrated with the generic functions used for the code execution.
Don't know if the following is a viable solution for you, but can you simply make a copy of sp_helpconstraint as sp_my_helpconstraint and in that version comment out "print" and "raiserror" commands?
|
|
Thu Jul 19, 2012 11:39 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
 |
 |
Don't know if the following is a viable solution for you, but can you simply make a copy of sp_helpconstraint as sp_my_helpconstraint and in that version comment out "print" and "raiserror" commands? |
Unfortunately, that's not an option. It would require maintaining a large number of different procedures on several servers. As a workaround, I had torn the guts of it instead and put it into the snippet. The drawback is that the snippet became a mess. And to make it worse, I'll have to do that to some other snippets as well :)
|
|
Fri Jul 20, 2012 6:11 am |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|