Solved

MsgBox in SQL?

Posted on 2007-03-27
3
5,345 Views
Last Modified: 2012-08-13
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):

IF TRUE
msgBox 'This is true!'
ELSE
msgBox 'This is false!"
END IF

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?
0
Comment
Question by:irishm20
3 Comments
 
LVL 42

Assisted Solution

by:dqmq
dqmq earned 20 total points
ID: 18801629
There is no message box.   You can  use SELECT 'This is true'
0
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 30 total points
ID: 18801635
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.
0
 

Author Comment

by:irishm20
ID: 18801700
DanielWilson...

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.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now