Trapping losing commands

In our applications once in a while the commands don't get through to the SQL 
Server for different reasons. Since it is an automatic process there is 
nobody in the front end to rerun those command, and they are getting lost.
The rezones for the lost could be: Time out, broken connections, Deadlocks 
ect.
Is there a way SQL can trap these and replay them?

0
Utf
9/2/2010 7:49:03 AM
sqlserver.server 1327 articles. 0 followers. Follow

1 Replies
682 Views

Similar Articles

[PageSpeed] 49

Gal (Gal@discussions.microsoft.com) writes:
> In our applications once in a while the commands don't get through to
> the SQL Server for different reasons. Since it is an automatic process
> there is nobody in the front end to rerun those command, and they are
> getting lost. The rezones for the lost could be: Time out, broken
> connections, Deadlocks ect. 
> Is there a way SQL can trap these and replay them?
 
You could use TRY CATCH to that end, but retrieving the query text is 
non-trivial. And in the case of a query timeout, this is nothing you
can trap in SQL Server. Nor if the network connection get severed.

It would be better to trap these errors in the application and resend them.
Before you do,make sure that you issue
"IF @@trancount > 0 ROLLBACK TRANSACTION".

I like to point out that I am not sure that would like to do this
automatically. Let's say that you submit a batch which performs an
update, and then returns a data set. The update succeeds, but the 
SELECT is blocked, and the query timeout sets in. If you redo the
batch, you may run the update a second time, which may not be good
at all. 



-- 
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

0
Erland
9/2/2010 9:47:13 PM
Reply:

Similar Artilces:

VLookup VBA error trapping
Can anyone tell me how to modify this formula to trap errors? I tried wrapping it in IsError (code) Then...but it doesn't work. Public Sub RunMeNow() Dim i As Long Dim iLastRow As Long With Sheets("Sheet2") iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 3 To iLastRow 'iLastRow to 1 Step -1 .Cells(i, "B").Value = Application.VLookup( _ .Cells(i, "A").Value, Range("RegionGrouping"), 2, False) Next i End With End Sub Or any other way I can handle an error with this type of pr...

trapping LVN_ENDSCROLL
Hi there, I'm trying to trap the LVN_ENDSCROLL notification in my parent, but don't seem to get it. Here's what I have. In my parent's header: void OnLvnEndScroll(NMHDR *pNMHDR, LRESULT *pResult); In the source: void CSKListCtrl::OnLvnEndScroll(NMHDR *pNMHDR, LRESULT *pResult) { Invalidate(); UpdateWindow(); *pResult = 0; } In the message map: ON_NOTIFY(LVN_ENDSCROLL, WM_QUICKLIST, OnLvnEndScroll) where WM_QUICKLIST is mapped to my child's ID. What am I doing wrong? Thank you. Well since I couldn't find a way of trapping LVN_ENDSCROLL, I just used the HSCROL...

How do I create a warning message on a command button
I am a newbie to anything above basic level in Excel. I know how to create and use Command Buttons, but I need to create a "Warning! Are You Sure" message when you click the button, with "Yes", "No", and "Cancel" options. The code is MsgBox "Warning! Are You Sure", vbYesNoCancel But you'll want it to be part of a conditional statement, for example If MsgBox("Warning! Are You Sure", vbYesNoCancel) =3D vbYes Then Exit Sub End If HTH On Jan 23, 4:13=A0am, lkreeder <lkree...@discussions.microsoft.com> wrote: > I a...

losing emails to distribution groups
Hi, We have an exchange 2003 sp2 server. In the last 3 months occasionally emails sent to distribution groups don't get through, from both internal addresses and external ones. For example today one of our users sent an email to a client cc'ed the support group, the client replied to all, but neither email arrived at the support distribution group. However if when I sent a test emails internally and from an external account to the group they get through. The support group gets 300 emails a month, and we know of only about 5 in the last month that hasn't got through. The same ...

Command line utility to capture system utilisation
Is there any command line utilisation to capture CPU, memory, network, harddisk or some of these ? Thanks, sc On 7/28/2010 3:07 AM, dingdongdingding wrote: > Is there any command line utilisation to capture CPU, memory, network, > harddisk or some of these ? Thanks, sc Which version of Windows XP are you using? With XP Pro you can use WMIC. John Mine is Home. Advice ? Thanks On Jul 28, 6:51=A0pm, John John - MVP <audetw...@nbnot.nb.ca> wrote: > On 7/28/2010 3:07 AM, dingdongdingding wrote: > > > Is there any command line utilisation to capture CP...

Trapping errors
How do write a piece of code that traps VBA error messages and ignores them? See my post on 22/07/07 about an Automation error message Thanks Tony Take a look at what Allen Browne has at http://www.allenbrowne.com/ser-23a.html -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Tony Williams" <tw@invalid.com> wrote in message news:uWKdkqVzHHA.5992@TK2MSFTNGP02.phx.gbl... > How do write a piece of code that traps VBA error messages and ignores > them? > See my post on 22/07/07 about an Automation error message > Thanks >...

Trapping for keystrokes...
Is there a way I can write a little program that will trap the keyboard and save whatever is being typed to a file? In other words, I need to write something that will run in the background but will be able to know whatever is typed on the keyboard and then save those keystrokes to a file on the hard drive. Thanks, Fred A keyboard hook. joe On Tue, 30 Sep 2003 03:41:26 GMT, "sftwrdvlpr" <bogus@news.com> wrote: >Is there a way I can write a little program that will trap the keyboard and >save whatever is being typed to a file? In other words, I need to write &g...

Trapping a value to use in my form
I am quite new to this and need some help. I have a form with a record source of a query. In the query I have the criteria set to ask the user a question in a popup box which searches a table for that input which is then reported back to the form to view EmployeeNumberQuery is as follows: Field: Employee Table: Employee_Number Criteria: [Enter the Employee Number] <-this is the value I want to capture and display in the form This query also has other fields that are reported back to the form that match the entered value The Employee_Listing_Table is as follows: Form Hea...

command buttons
Greetings, I have two command buttons A and B which are connected to subforms on the main form.I have a table"Client" and field "A/B". My goal is when I click amdA I want the field "A/B" show A, whe I click cmdB I field "A/B" will show B. If any solution? For me it's puzzle.Thx. -- Patric Patric, Assuming that the control you want to populate on the main form is named 'A/B', put the following code in the On Click event for button A: Forms![Name of main form]![Name of sub form control].Form![A/B] = A In the On Click event for button B:...

Problems sending SMTP mail from command line
We have recently migrated our Exchange set up from 5.5 to 2003. We operated in mixed mode for a while but removed the last 5.5 server from the domain yesterday - and put our Exchange 2003 domain into Native mode. All went smoothly. Today we have noticed that when we try to send emails from the command line (one of our SQL servers sends emails using GBMAIL), it will not send emails to the outside world, returning an SMTP Error 550. However, we can send emails to internal addresses using the same process. What do I need to do to configure these emails to get to the outside world? ...

If Function
I have a basic If Function, (see below) Is there anyway I can add a 'and' command? So it could read: =IF(B3=B16 and B16 does not equal to 0,1,0) how can I add 'and B16 does not equal to 0'? =IF(B3=B16,1,0) Aaron Aaron, Try: =IF(AND(B3=B16,B16<>0),1,0) -- HTH Sandy sandymann@mailinator.com Replace@mailinator with @tiscali.co.uk "aronnov" <arussell@faultlesscaster.com> wrote in message news:OeAWrN5wFHA.2724@TK2MSFTNGP10.phx.gbl... >I have a basic If Function, (see below) Is there anyway I can add a 'and' >command? So it cou...

windows resize event trap
I am trying to resize a form inside of excel base on windows resize event (not workbook resize)... I've already try Private Sub appevent_WindowResize(ByVal Wb As Excel.Workbook, ByVal Wn As Excel.Window) MsgBox "you have resized excel" End Sub and it works only with workbook resize... I'll appreciate any help on this... thanks LH ...

Cannot run net use command
When trying to run the 'net use' command I get a message like 'the command 'net' is not recognized as an internal or external command. The path is correct in Environment Variables - what could be causing this? "Mike" <texan767@hotmail.com> wrote in message news:a4d40d1d-c1eb-4ae9-b796-06d8fe849440@p35g2000yqh.googlegroups.com... > When trying to run the 'net use' command I get a message like 'the > command 'net' is not recognized as an internal or external command. > The path is correct in Environment Variables - what...

save text field w/ leading zeros in .csv format & not lose zeros?
I currently have a csv file with a field that has one digit numbers. I need to create a text field and convert the one digit number to two digit text by adding a leading zero. I have tried using the concatenate function to add the leading zero, but when I close the csv file, it reverts back to one digit. How can I get the file to save the field as text and include the leading zero? Check your CSV file in Notepad, not in Excel. Excel will frequently convert your text representation of a number into a number, even though it likely was written out to disk with the leading zero "...

transferring MSN Dialup messages to Outlook 2002 loses original da
I am trying to move my saved (on my computer) MSN Dialup emails into Outlook so that I do not have to have MSN 9 running to read them. I can transfer the saved emails to the MSN server and see them in Outlook, but while the original message date and time are there when I look at the email in MSN 9, when I look at it with Outlook, the transfer date and time are there instead. A message which had never been transferred to my computer appears in Outlook with the correct date and time. The messages look identical in MSN, but in Outlook one has the transfer date instead of the original date,...

Trapping Ligitimate Mail
Have IMF installed on Exch 2k3. I know I can adjust the sensitivity of the filter. It seems to be catching most spam, however, one person's mail always seems to be trapped. This person usually has to send zip files. Is is possible force exchange to accept mail from this person? Is the file attachment the issue? Thank you, Justin You could add them to the safe senders list within the IMF filter. "Justin" wrote: > Have IMF installed on Exch 2k3. I know I can adjust the > sensitivity of the filter. It seems to be catching most > spam, however, one person&#...

OWA Loses Message Content When Forwarding?
I find that whenever I forward an email in the OWA client, the contents of the original message are lost and I receive the error: Error: Access is Denied. Tried setting the "HTTP 1.1 through proxy connections" in IE browser options, but still no effect. Any ideas? If so, please reply to: rfoszcz@mchenry.edu if you have any ideas... Thanks. Russ Foszcz You might want to post this to an Exchange news group as OWA is a part of Exchange Server, not Outlook. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the SWEN virus,...

Trap Receiver
Dear All, I am developing a utility for receiving traps(Trap Receiver). I needed help as I dont understand where to start and how to do it. Please help. Dinesh What is a trap and what does it mean to receive one? Possibly the reason you don't know how to start is that you are trying to do something that is not defined or possible. joe On Thu, 22 Apr 2004 11:04:51 +0530, "Dinesh" <dinesh@netplexusindia.com> wrote: >Dear All, >I am developing a utility for receiving traps(Trap Receiver). I needed help >as I dont understand where to start and how to do it....

How do I create a command from a list box
I want to select an item in a scroll list or drop down box and by selecting a specific item in that list have excell proform a different function. For example: I have a list of numbers that each represent a discription. I want to select the number from the list and have excell paste the description for that number in a different box. I want each different number to have a different description. You could use Data|Validation and =vlookup(). Put the list in sheet2, column A. Put the description in sheet2, column B. Then if your cell is A1 (of sheet1), you can put this in B1: =if(a1=&qu...

Keeping data without losing Formula's
I have a worksheet (named monthly) with a column of data under a certain month (which will change each time data is entered - stocktake). However this column needs to be edited each month and has formula's in it so it will work (not always the same data in the column). I decided to put this data into a yearly sheet under the particular month. The only way I can do it at the moment is to copy and paste special. How do I (or is there a way to) put this data in a sheet that has all the months but under the month that is signified. In other words I don't want formula's in the yearl...

trapping charts event
I'm writing a macro in which the user has to choose 2 value on a bar-graph. I can trap chart events as Jon Peltier say ( http://www.computorcompanion.com/LPMArticle.asp?ID=221, ), but following his way I trap *always* chart events. What I want is to trap chart event in a chart sheet only one time, and after that I want to leave the charts event control back to excel. Is it possible? Sorry for my newbie-ness :-( When you have the information you need, and don't need more events from the chart, deactivate the chart events. Set clsEventChart.EvtChart = Nothing - Jon ------...

losing indents next to graphics
I am using Publisher 2002. I print a 20 page magazine for my nonprofit, printed on both sides on an HP8550gn. Two columns per page. Whenever I insert a graphic that overlaps the columns with the text wrapping, I lose the indent on the right side of the graphic, left side of the column. It is not just in the printing, it shows no indent on the monitor. I have to go in and move indent manually. This would be okay but what I see on screen is not what I get in print. Any help will be greatly appreciated. Donald AVM ...

Advanced Find Command??
Is there an advanced find command or some kind of command where I can search through a particular column of dates and go to each row where the date is less than Feb 1, 2005. I thought I could use either the filter command but couldn't use the advanced filter to find dates?? Try an AutoFilter. Specify "Custom" on drop-down and select "is less than" and then the date. HTH Jason Atlanta, GA >-----Original Message----- >Is there an advanced find command or some kind of command where I can search >through a particular column of dates and go to each row ...

ESEutil commands
I need a step by step guide on using eseutil. I need to learn how to use this tool to commit the logs to the database On Tue, 23 Nov 2004 18:09:02 -0800, "Ed" <Ed@discussions.microsoft.com> wrote: >I need a step by step guide on using eseutil. I need to learn how to use this >tool to commit the logs to the database eseutil/? A full online backup of the store will commit the logs. What exactly are you trying to accomplish? I have another site that will not have a backup solution in place until next month so i would to know how to flush the logs using this utility ...

Exchange admins lose permissions to private stores
I am having a bunch of odd problems here at work. First I lose the ability to do brick level backups. Then I get errors using exmerge. THinking it is a permissions problem I map to the M: drive and sure enough, none of my exhange admin accounts can access the mailboxes. I have tried to add/re add them but it isnt working. I really need to get this fixed, any ideas? The Exchange admin accounts are still all listed with the correct permissions, they just dont work. I tired running Domain Prep again, no go. I have weird issues going on with my account like not getting attachments in active sync ...