• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6900
  • Last Modified:

MsgBox in SQL?

Is there a way to print out message like with VBScript's MsgBox() but in SQL?  This would be for debugging my SQL code; as an example I'd like to do something like this (but I need the SQL equivalent):

msgBox 'This is true!'
msgBox 'This is false!"

I've tried the PRINT command in SQL but nothing happens or at least I'm not sure where it gets printed to?  I'd prefer something like a message box.  Any ideas?
2 Solutions
There is no message box.   You can  use SELECT 'This is true'
Daniel WilsonCommented:
MS SQL Server?

No, there is no msgBox -- primarily b/c the SQL Server runs its own process, likely under a different user context, likely on a different machine.

If you're testing your code in Query Analyzer, Print should work for you.

Otherwise, you may need to SELECT something to debug by.
irishm20Author Commented:

Thanks for the explanation... I will use Query Analyzer to debug.  I was trying to debug inside of a DTS package workspace but I think I limit myself to just scripts if I want to debug in that screen.  Thanks again.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now