What is the most effective way to write Statement to catch and reverse errors during query excution?

Hello my friends:
I am wondering what is the most effective way to deal with errors, specifically in a
Stored Procedure.
I wrote something like this:
BEGIN TRY
BEGIN TRANSACTION
/*My statements goes in here*/
IF ERROR_NUMBER() = 0 -- Do I need this line?
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
IF ERROR_NUMBER() > 0 --Do I need this line?
ROLLBACK TRANSACTION;
END CATCH;
It would make sense using the if Statement when attempting to log errors.
Just too many variations.
Thanks

Also read this great article
http://sqlblog.com/blogs/alexander_kuznetsov/archive/2009/05/13/your-try-block-may-fail-and-your-catch-block-may-be-bypassed.aspx
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence

Similar Messages

  • What is the most effective way to get ospf to function and what is the basic command structure

    I am doing a project of ospf and need to know if I am on the right tract somehow these commands are not working and wondering if I am doing something wrong.

    Hello,
    I would say the basic configuration for OSPF should be:
    1. router ospf  1
             2.   Router-id 2.2.2.2 ( if you want to hardcode the router-id else you can go with the default which would be the highest interface on your router)
             3.  Network  192.168.0.0 0.0.0.255 area 0 (telling the router * I care about the 192.168.0 part of my ip and the last part can be anything thus the 255)
        4.      Net   192.168.2.2 0.0.0.255 area 0 (telling the router * I care about the 192.168.2 part of my ip and the last part can be anything thus the 255)
    OR for the 192.168.0.0 and 192.168.2.0 you could just have 192.168.0.0 0.0.255.255 meaning I only care about 192.168 and 0.0 can be anything.
    The four lines above would be my basic config for ospf. Also have a look at these links, they provide some insight into ospf and how it should be configured. http://www.cisco.com/en/US/docs/ios-xml/ios/iproute_ospf/configuration/12-4/iro-cfg.html#GUID-588D1301-F63C-4DAC-BF1C-C3735EB13673
    http://www.cisco.com/en/US/tech/tk365/tk480/tsd_technology_support_sub-protocol_home.html
    I have also experienced that I cannot configure all OSPF commands on PT but prob GNS3 allow all configs.
    HTH.
    DJ.

  • What is the most effective way to get my imac 2 ghz intel core duo 2 10.4.11 to be able to run 10.5 and sync with my iphone 4s?

    What is the most effective way to get my imac 2 ghz intel core duo 2 10.4.11 to be able to run 10.5 and sync with my iphone 4s?

    As your Mac should run Snow Leopard provided it has at least 1GB memory, that would be a good deal easier and very much cheaper than trying to find a 10.5 install disc.
    Snow Leopard costs $30 approx from the online Apple store (£26 if you're in UK)
    You'll need to update Tiger to 10.4.11 with the combo installer first (unless you're just erasing the disc and starting fresh) You can then update SL from 10.6.3 to 10.6.8 with its combo installer.
    For comparison, 10.5 Leopard is currently running about $130 from Apple (if still available) and more on Amazon etc.
    This info for Leopard courtesy of TexasMacMan;
    Mac OS X 10.5 Leopard installation system requirements
    http://support.apple.com/kb/TA24950
    Leopard is no longer available at the Apple Store but may be available by calling Apple Phone Sales @ 1-800-MY-APPLE (1-800-692-7753).
    If you can't obtain a retail install DVD from Apple, look on eBay or Google the installer part numbers to possibly find at an on-line store. Here's what to look for:
    MB427Z/A  Leopard 10.5.1 install DVD
    MB576Z/A  Leopard 10.5.4 install DVD
    MB021Z/A  Leopard 10.5.6 install DVD (single user)
    MB022Z/A  Leopard 10.5.6 install DVD (5-user family pack)
    Installing Mac OS X 10.5 Leopard
    http://support.apple.com/kb/HT1544
    Mac OS X 10.5 Leopard Installation and Setup Guide
    http://manuals.info.apple.com/en/leopard_install-setup.pdf
    After you install the base 10.5, download & install the 10.5.8 combo update at http://support.apple.com/downloads/Mac_OS_X_10_5_8_Combo_Update

  • What is the most efficent way to create both a standard and HD DVD

    Hi,
    I'm just getting into HD video editing, and I have relatives who will be several years behind me. I will be making HD DVD's for myself to use, but I will also need to make standard DVD's to send to my relatives.I am assuming that the HD DVD's I create will not play in a standard DVD player. I may be wrong. However, If this is correct, is there a particular point in the process of working with Encore where I can make that choice, create the DVD, and then go back and alter it in order to create the other type without destroying and having to redo everything that was done up to that point?

    Thank you Hunt. Being ahead of most of the rest of the world and getting the best technology out there can be a pain sometimes. Reading through Jon Geddes' article left me scratching my head several times, and some of it went way over my head, but I'll keep at it, until it sinks in. Some language, terms, and shorthand, I'm sure are simple to understand to a lot of people, but I'm not in that catagory. I'll just keep working at it. 
    Terry Lee Martin
    Date: Sun, 18 Oct 2009 13:39:08 -0600
    From: [email protected]
    To: [email protected]
    Subject: what is the most efficent way to create both a standard and HD DVD
    I would edit the Project in HD in PrPro. The BD authoring part will be straight workflow.
    For the SD DVD-Video, you have a few choices. You can Export to DV-AVI Type II for Import into a new Encore Project for the DVD. Some feel that PrPro does not do a good job at down-rezing from HD to SD. For a workflow that will likely yield better quality, see this http://www.precomposed.com/blog/2009/07/hd-to-sd-dvd-best-methods/. If you have PrPro/Encore CS4, then Jeff Bellune's /thread/487134?tstart=0 might be useful to you. Just follow the links to the tutorial.
    Good luck,
    Hunt
    >

  • What's the most effective way to speed up AVCHD video editing?

    Hello Everyone,
    I'm having the same problem, my wife and I have a small wedding videography company, I film jobs on weekends when I'm not working full time and my wife stays home with our 2 year old daughter and edits during the week. 
    When jobs come in we both are using our macbook pro's for the import process because it takes SOOO long to import all the avchd clips.  We're filming with the Panasonic HMC40 shooting in 720/30p on Class 10 16GB SDHC Cards.
    I have an early 2008 macbook pro, 2.4Ghz Core 2 Duo 2GB of ram, and my wife has a 2010 unibody with a dual core i5 w/ 4GB of ram.
    As a test, I imported an 8 minute and 47 second clip in my machine, and the import takes 20:39.  I went to my local apple store and ran the same import test on brand new machines and here are the results:
    mbp Core 2 duo 2GB ram time: 20:39 (my machine)
    mbp dual core i5 4GB ram time: 7:08 (my wife's machine)
    mbp quad core i7 4GB ram time: 4:50
    mba core 2 duo 1.86Ghz 2GB ram SSD 64GB drive time: 12:17
    imac quad core 2.7Ghz 4GB ram time: 4:54
    imac quad core 2.8Ghz 3GB ram 4:27
    mac pro 2.8Ghz 3GB ram 3:42
    I watched the quad core i7 macbook pro's performance monitor, and at one point it had 63 iMovie threads running to import the footage.  The biggest bottleneck for importing avchd seems to be the processor.  With an import time of about have of the real time, that has the biggest appeal to me, but comes at a starting price of $1799 + tax, and is expensive. 
    What I'm looking for is the most cost effective way to cut down on import and export times for either new hardware or software.  I haven't tested the elgato h.264 HD encoder yet, nor have I tested the new Final Cut X.  Has anyone done this? What about Adobe Premier Elments or Premier Pro
    Our compeditors are offering 'same day edit' services, and making basically a trailer of the events that happen at the ceremony, then editing them on site in a 3-4 hour time window between the ceremony and reception, then using a projector and screen to show that trailer at the beginning of the reception, usually added to the slide show. 
    That's the kind of thing that we want to be able to do for our customers, but also to cut down the massive amount of editing time it takes to get every finished product out the door.
    What does everyone think?  Is the elgato h.264 HD encoder worth it?  Is there a more professional avchd / h.264 hardware / software solution that can speed up the import process faster?
    I'd love to know everyone's thoughts.
    Thanks.
    Chris
    [URL="http://freedomvideography.com"]Wisconsin Wedding Videography[/URL]

    One thing you might consider...
    Go to Final Cut Pro X.
    In FCP 10, you can import AVCHD and begin editing immediately. You can edit natively in AVCHD if your needs are very simple, but most people would use FCP to "optimize" the AVCHD to ProRes 422, which is an intermediate codec like Apple Intermediate Codec, but provides higher quality. The optimizing to ProRes 422 as well as analyzing for stabilization, sound, and color takes place in the background if you have cores available.
    But you can edit immediately, and as the optimized clips become available, FCP will automatically use them instead of the AVCHD clips.

  • What is the most effective way to consolidate my iTunes library (there appears to be 2-3 separate origins)?

    Hello all!,
    I've come across a problem regarding the source of my Music files on my MacBook Pro, finding that my fairly large (76 GB) iTunes library is made up of files from a large range of locations.  I've had this Macbook for ~3 years now & have never necessarily worried about the amount of audio on the harddrive.  As I noted, I have 76GB of music on iTunes, but the "Audio" section of my harddrive is 215GB. Based on looking at the iTunes/iTunes Media section of my files I've come to the conclusion that my process of finding and adding music to my library has resulted in a large amount of duplicates and/or multiple locations.
    I began by going through and deleting unwanted songs from my library, to see the effect it would have on the overall "Audio" on my harddrive. This didn't do much, leaving me with a ~54GB iTunes library, but a recorded 191.4GB of audio on my harddrive. It appears that the "Music" sub-folder of "iTunes Media" is a duplicated, older version of my iTunes library but I'm weary about deleting it in fear that the songs sources will end up "broken" and they won't play or sync.
    I've browsed other questions and found scripts for similar situations but I'm not sure exactly how to go about using them, or if they're necessary/correct for this situation. What is the suggested manner for organization of music in iTunes? The suspected duplicates folder is located under "Music -> iTunes -> iTunes Media -> Music" and this seems like far too many folders for a library of relative simplicity.
    The last question I have is if the albums I download are staying in my "Downloads" folder when adding them to iTunes, creating yet more duplicates (rather than simply being transfered to the iTunes folders)? I'd appreciate any help, hopefully I was clear about the problems I'm facing. The system I've been using works, but I want to get all of my audio files cleaned up properly.
    Thanks!

    "Audio" is more than just your iTunes files. Audio files for other apps (like Garageband, Office or Roxio Toast) can add to the overall size of "Audio".
    The iTunes Media folder should be within a few gigs at most, of the size of what your Library shows. It won't be exact because iTunes uses binary calculation to determine size and Finder uses Decimal. (1024mb vs 1000mb for a gigabyte)
    My iTunes library is 168Gb in iTunes - the files are 191Gb in FInder.
    Your iTunes files should be in [user]Music/iTunes/iTunes Media/ by default, but you can choose ANY ONE location, on an internal or external hard drive, as long as iTunes is properly pointed to it as your Library. The Library files (.itl, .xml, .itdb, and artwork) should still remain in the default location.

  • What's the most effective way when leaving feedback?

    should I put all of my eggs in one basket and state all of my wishes and concerns in one message, or send in separate feedback msgs for each app/feature request? i have multiple issues with overall function, mail, sms, safari, bluetooth, and calendar.
    thanks!

    I would break up your feedback requests (via the Feedback link please) into 1 or two items at a time instead of one long list of multiple requests.

  • The most effective way from varchar2 to CLOB?

    this is my table's TAB structure on Oracle 10g r2:
    TAB_ID (PK),
    TAB2_ID (FK constraint to TAB2(TAB2_ID), index created),
    TEXT varchar2(4000)
    What is the most effective way to convert varchar2(4000) column to CLOB column?
    1. create new table TAB_NEW with column TEXT as CLOB,
    then insert /*+ APPEND */ into TAB_NEW SELECT * FROM TAB,
    then rename table TAB to TAB_OLD,
    then drop constraint and indexes
    then rename TAB_new to TAB
    then add constraints primary key and foreign key,
    then add index on TAB2_ID
    then drop table TAB_OLD
    OR
    2. rename column TEXT(varchar2) to TEXT_OLD
    then add column TEXT(type CLOB)
    then update(how the most effective?) TAB set TEXT=TEXT_OLD
    drop column TEXT_OLD.

    1 will work, as you can assign a VARCHAR2 to a CLOB and Oracle will convert it.
    2 is redundant.
    Sybrand Bakker
    Senior Oracle DBA

  • I have an ipod classic with 4gb, it is full. What is the most economical way to upgrade to at least 16gb

    I have an ipod classic with 4gb, it is full. What is the most economical way to upgrade to at least 16gb?
    (I don't want to delete anything)

    To recover the photos from an iPod Classic you'll need to use third-party software and the photos gained will be quite low resolution.
    See https://discussions.apple.com/docs/DOC-3991 for possibilities.

  • What's the most efficient way to transfer to personal domain?

    I've been using the cumbersome .Mac address and have spent a lot of time optimizing the site, having also purchased a domain name (which I'll switch to), which is currently masked and forwarded. So what's the most smooth way of using the personal domain without losing all the strides I've made to get bumped up in the rankings? Thanks in advance for your suggestions. www.RedCottageInc.com (that's my future personal domain!)

    I'm saying that you give Google the .Mac URL to get to your sitemap but use the registered domain name for normal access.
    You are promoting your site with www.RedCottageInc.com but, because it is masked, Google needs your web.mac address to access the verification file and the sitemap so that it can spider your site.
    You normally upload your sitemap as "sitemap.xml". You can test its accessibility by entering
    http://web.mac.com/username/WebSiteName/Sitemap.xml in your browser.
    Google needs this URL to get to the sitemap - visitors will use www.RedCottageInc.com.
    Google wants to get to the verification file and the sitemap but your website visitors don't.
    I guess all this is confusing if you haven't done it before and I don't know that I am explaining it very well. The best way to get it is to go through all the steps of creating the verification file and sitemap, uploading them to your site folder and adding and verifying in your Google control panel.
    Here are the relevant Google pages...
    Guidelines...
    http://www.google.com/support/webmasters/bin/answer.py?answer=35769
    Add URL to Google...
    http://www.google.com/addurl/?continue=/addurl
    Verification file....
    http://www.google.com/support/webmasters/bin/answer.py?answer=35658&query=html+f ile&topic=&type=
    Sitemap...
    http://www.google.com/support/webmasters/bin/answer.py?answer=34657&ctx=sibling

  • What's the most efficient way to serve a file from a servlet?

    I have a servlet that does various different things depending on the needs. Sometimes it dynamically generates content, and sometimes all it does is send a file out, with no alteration.
    What is the most efficient way to just send a file?
    One option:
    OutputStream os = response.getOutputStream();
    InputStream is = new FileInputStream(...)
    (send all the bytes from is to os, the regular way using a buffer)Another option is to say:
    RequestDispatcher rd = response.getRequestDispatcher(fileName);
    rd.forward();Any other options? What's the prefered way of doing this?
    I know the rule of "don't optimize too early" but this is a situation where we need to get the maximum amount of files served with the hardware we have, and it's going to be a lot of static files, so efficiency is important.
    Thanks

    Ok, that's what I thought. It would be nice if there were a "response.sendStream(InputStream input)" method in the ServletResponse class. Even nicer would be a sendFile or sendChannel or something. This is probably a common usage and it's a place where the container has many opportunities for optimization. For example, it could call the operating systems send_file kernel call so the entire transfer would be done directly from the disk controller to the ether card (on systems that support that).
    For now I'll just do my own buffered copy.

  • I am giving my old MacBook Air to my granddaughter.  What is the most efficient way to erase all the data on it?

    I am giving my old MacBook Air to my granddaughter.  What is the most efficient way to erase the data?

    You have two options.....
    One is to do a clean reinstall of your OS - if you still have the USB installer that came with your Macbook Air...
    The second option is to create a new user (your granddaugher's name).....Deauthorize your Macbook Air from your Itunes and Appstore.....
    Restart your Macbook after you've created your granddaughter's user name, login under your granddaughter's username and delete your username.
    Search your Macbook for your old files and delete them.....
    Good luck...

  • What is the most efficient way to have full access to the front panel on RT Labview?

    I have a RT machine that needs to do its job and also port the front panel to an external machine over the network. What is the most efficient way to do it? Using as little of the RT time as possible but providing full functionality to the RT front panel.
    So far I have been using it directly from Labview - running the VI on a remote (RT) and have the front panel on local Labview (WINDOWS). I know I can do it with also through WWW (not very happy with that though).
    LV2009 SP1.
    Thanks

    Running a compiled executable on the RT target, rather than running it within the development environment, is probably slightly more efficient but limits you to the web interface.  If you're running within the LabVIEW environment, I doubt there's a noticeable difference in efficiency from the RT perspective between the web server and the LabVIEW front panel, although that's mostly a guess (I would expect the RT system to send identical data in each case, once the front panel is loaded).  Those are your only options in modern LabVIEW versions.  In LabVIEW 7.1 you could build an executable that acted as the front panel for an RT system, but that feature does not exist in recent versions.  However, a quick search turned up this document with code to approximately duplicate that behavior, perhaps it will work for you?

  • What is the most efficient way to convert a static site to a responsive site using Dreamweaver?

    I need to convert an old site made in Dreamweaver to be responsive to any monitor size. What is the most efficient way to do this?

    Depending on what you have to work with and how it was coded, it might be doable and then again not.  Suffice it to say, there are no magic buttons that will do this for you. Also consider that mobile & tablet users interact differently with their web devices. So your navigation & forms must be finger friendly.  Also images & content must make mobile users happy without killing their dataplans.  There's a lot of planning that goes into making a good Responsive Web site.
    Nancy O.

  • What is the most efficient way to turn an array of 16 bit unsigned integers into an ASCII string such that...?

    What is the most efficient way to turn a one dimensional array of 16 bit unsigned integers into an ASCII string such that the low byte of the integer is first, then the high byte, then two bytes of hex "00" (that is to say, two null characters in a row)?
    My method seems somewhat ad hoc. I take the number, split it, then interleave it with 2 arrays of 4095 bytes. Easy enough, but it depends on all of these files being exactly 16380 bytes, which theoretically they should be.
    The size of the array is known. However, if it were not, what would be the best method?
    (And yes, I am trying to read in a file format from another program)

    My method:
    Attachments:
    word_array_to_weird_string.vi ‏18 KB

Maybe you are looking for

  • SSL error happened while calling a web service on a managed oc4j instance

    While calling a webservice, I got SSL Error: Unrecognized SSL message, plaintext connection? The webservice is deployed on a managed oc4j which is created on a 10.1.3.4 oracle application server. We have SSL certificate installed for http server. Any

  • Use APEX_APPLICATION in an application process called by a javascript

    I have a page that is split into two; Top portion is a form, and the bottom part is a tabular form of a collection. Currently, if I enter information into the form and the collection and then submit the collection (to save the data to the collection)

  • Problem in Content conversion

    hi all, I am working on a scenerio in which file is the target.I have only 1 field at output and on every execution the output needs to be appended into original file. EX: output1       output2       output3 My output file is of type catalogue file n

  • SQLServer connection in Connection Navigator doesn't display any tables ...

    I connect to a SQLServer DB using the steps described in the help and I can query tables just fine, but when I click on the Tables or Views, I see nothing. I can start up a SQL worksheet and get data from the database just fine. I can also connect us

  • 500 Internal server error -Help me

    Hi all, We are getting 500 Internal server error,when we try to forward using dispatcher in our servlet.We couldn't find any exact reason why this error occurs. There is no exception also. Can anyone suggest us that what could be the reason? we are u