Solved

MsgBox in SQL?

Posted on 2007-03-27
3
5,550 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Querying data from 3 SQL tables 2 32
T-SQL: Do I need CLUSTERED here? 13 43
date diff with Fiscal Calendar 4 30
SQL - Update field defined as Text 6 17
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

773 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