473,663 Members | 2,705 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('Constra int ' + @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_nam e' 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 1302

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

Similar topics

3
2927
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
11753
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 table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem I have is I cannot retain the primary key field in a variable which is then used in a SQL update...
7
1357
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 in my code I would have multiple searches. But I can't figure out how to do it without it barfing.. The error is straightforward ..
1
1463
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 error_message is messed up. Do you have any idea as to how to fix it?. Thanks.
20
3911
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
2029
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 import MIMEMultipart; from email.MIMEText import MIMEText; from StringIO import StringIO
1
2130
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 procs like for ex the below is th epart of the stored proc If @ProcessId = 2 BEGIN
3
6420
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 of SP : set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER PROCEDURE .
3
1386
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 and invoke http://www.jslint.com/ validator? Thanks for help. Here's the code: var reEmail = /^{1,40}@{1,70}$/; var reDate = /^(\d{4})(\/|-)(\d{1,2})(\/|-)(\d{1,2})$/;
0
8435
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7368
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5655
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
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 we have to send another system

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.