473,508 Members | 2,292 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error_message()

13 New Member
I have a stored procedure that drops all constraints and indexes then rebuilds them.

some of if goes something like this...

WHILE @@fetch_status = 0
BEGIN
SET @SQL = 'ALTER TABLE ' + @TableName + ' DROP CONSTRAINT ' + @ObjectName
BEGIN TRY
EXEC (@SQL)
END TRY
BEGIN CATCH
INSERT INTO ##NonDropped VALUES('Constraint ' + @ObjectName + ' on table ' + @TableName, ERROR_MESSAGE())
END CATCH

all works fine.
What I want to do is improve the error messaging.
If I try to drop a non-existant constraint I would get an error

Msg 3728, Level 16, State 1, Line 1 'constraint_name' is not a constraint.
Msg 3727, Level 16, State 0, Line 1 Could not drop constraint. See previous errors.
All error messege does is return the last message, which is a bit meaningingless. I can't seem to find a way of getting the first message which would be more usefull.

Any pointers?
Oct 24 '07 #1
0 1285

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2913
by: josh dismukes | last post by:
/// here is the code i'm getting a parse error on the last line of the code which /// is </html> any help will be much appreciated. <?php session_start ();
3
11737
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
7
1349
by: rh0dium | last post by:
Hi all, I believe I am having a fundamental problem with my class and I can't seem to figure out what I am doing wrong. Basically I want a class which can do several specific ldap queries. So...
1
1455
by: Kaushal Mehta | last post by:
Hello All, I tried to build imap_err.h and imap_err.c from imap_err.et but seems like IMAP Server always returns "Unknown code" to the email client?. Looks like the code being passed to...
20
3893
by: John Salerno | last post by:
I'm starting out with this: try: if int(text) 0: return True else: self.error_message() return False except ValueError: self.error_message()
1
2025
by: nil111181 | last post by:
import smtplib import mimetypes; from optparse import OptionParser; from email import Encoders; from email.Message import Message; from email.MIMEBase import MIMEBase; from email.MIMEMultipart...
1
2122
by: sanika1507 | last post by:
hi all, how to debug a stored procedure .. Actually what i did was split the stored procs and took and SQL query and executed it... but i dont knw how to print the values of these stored...
3
6414
by: iitt2007 | last post by:
In my SP, I am using SELECT @error_message= 'string' . My collegue asked me to use SET@error_message= 'string' , I would like to know the differences for using SELECT vs SET. Here's the snippet...
3
1376
by: r_ahimsa_m | last post by:
Hello, I am learning JavaScipt. I have written some functions and I verified my code using http://www.jslint.com/ validator. I don't understand the problems it reports. Could you help me please...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7120
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5050
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1553
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.