Showing posts with label update. Show all posts
Showing posts with label update. Show all posts

Monday, March 19, 2012

maintaining atomicity

Hello Friends,
Iam new to this sql server arena. I have implemented a procedure which does a series of insert and update statements and all of this statements must be implemented all at once or none. But if I got error in some statements , the rest of the statements are been executed. Please suggest me a way or code snippet to achieve atomicity in a sqlserver procedure.

regards,
Ch.Praveen Kumar.Use transactions:

begin tran

insert ...

if @.@.error<>0 begin
rollback tran
RAISERROR ...
return
end

update ...

if @.@.error<>0 begin
rollback tran
RAISERROR ...
return
end

commit tran|||Thank You For Your Reply. I Will Implement It.|||Hi,
I got a small doubt here. Whenever an error encounters, how to display the sqlserver error message rather than displaying our custom message with raiseerror. Is there any way to get the error message from sql server if an error encounters such as foriegn key violation. (invalid references to pk in mastertable)|||The problem that I see is that errors come back to the client application in a "stream", much like TDS or STDOUT provide. Transact-SQL sees the most recent error, the client sees every error. Unfortunately, the formatted error message (including things like object names) is only passed to the client, I don't think that Transact-SQL can even access it (although ADO can).

-PatP

Wednesday, March 7, 2012

mail que

hi,
we are having a trigger for update on a table.
this trigger fires the xp_smtp mail session proc.
the problem is that when there are many updates in a short while. (20
updates in a minute) some of the email don't arrive.
the updates are done one by one from a single location.
can it be that the server is too slow, or the proc is too slow to deal with
all the updates?
is there a way to wourkaroun it?
thanks,
prem
Hi
It is best not to call external process from within a trigger as it may hold
resources, is prone to failure and most times you can not handle the error
generated and your batch is rolled back.
Rather, in the trigger, write a row to another table, and have an exernal
process poll the table and send the e-mails.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"prem" wrote:

> hi,
> we are having a trigger for update on a table.
> this trigger fires the xp_smtp mail session proc.
> the problem is that when there are many updates in a short while. (20
> updates in a minute) some of the email don't arrive.
> the updates are done one by one from a single location.
> can it be that the server is too slow, or the proc is too slow to deal with
> all the updates?
> is there a way to wourkaroun it?
> thanks,
> prem
>
>

mail que

hi,
we are having a trigger for update on a table.
this trigger fires the xp_smtp mail session proc.
the problem is that when there are many updates in a short while. (20
updates in a minute) some of the email don't arrive.
the updates are done one by one from a single location.
can it be that the server is too slow, or the proc is too slow to deal with
all the updates?
is there a way to wourkaroun it?
thanks,
premHi
It is best not to call external process from within a trigger as it may hold
resources, is prone to failure and most times you can not handle the error
generated and your batch is rolled back.
Rather, in the trigger, write a row to another table, and have an exernal
process poll the table and send the e-mails.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"prem" wrote:

> hi,
> we are having a trigger for update on a table.
> this trigger fires the xp_smtp mail session proc.
> the problem is that when there are many updates in a short while. (20
> updates in a minute) some of the email don't arrive.
> the updates are done one by one from a single location.
> can it be that the server is too slow, or the proc is too slow to deal wit
h
> all the updates?
> is there a way to wourkaroun it?
> thanks,
> prem
>
>

mail que

hi,
we are having a trigger for update on a table.
this trigger fires the xp_smtp mail session proc.
the problem is that when there are many updates in a short while. (20
updates in a minute) some of the email don't arrive.
the updates are done one by one from a single location.
can it be that the server is too slow, or the proc is too slow to deal with
all the updates?
is there a way to wourkaroun it?
thanks,
premHi
It is best not to call external process from within a trigger as it may hold
resources, is prone to failure and most times you can not handle the error
generated and your batch is rolled back.
Rather, in the trigger, write a row to another table, and have an exernal
process poll the table and send the e-mails.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"prem" wrote:
> hi,
> we are having a trigger for update on a table.
> this trigger fires the xp_smtp mail session proc.
> the problem is that when there are many updates in a short while. (20
> updates in a minute) some of the email don't arrive.
> the updates are done one by one from a single location.
> can it be that the server is too slow, or the proc is too slow to deal with
> all the updates?
> is there a way to wourkaroun it?
> thanks,
> prem
>
>

Monday, February 20, 2012

LSASS.exe taking over CPU on incremental update (FT-Catalog)

Hello everyone,
I've managed to get FT-Population running after being at war with a changed user-account of mssql service (switched both back to localsystem, now the population works fine).
But if i want to do an incremental update, LSASS.EXE takes over CPU (as much as it gets) and my SQL is not available for any other queries.

I've tried this on similar tables with less records, but the error is the same (none, peaking cpu until completion).
The main problem is that the big table seems to take ~3-5 hours for an incremental update, and i cannot have the system running 100% (on 4 cpus) at this time...

System information:
Microsoft SQL Server 2000 - 8.00.194 (Intel X86) Aug 6 2000 00:57:48 Copyright (c) 1988-2000 on Windows NT 5.0 (Build 2195: Service Pack 4)

CPU: 4x CPU (don't know the clock)
Memory: 1.5 G

I have browsed newsgroups and other forums for a solution, but couldn't find any answer.
I've checked the service trough TokenMon and FileMon (sysinternals) but couldnt find any errors...

I would really appreciate any help!!

Thank you for every post!no one?|||This sounds like a fairly obvious and severe infinite-loop problem that surely must have been reported on Microsoft's support-site, and possibly fixed there. This sounds like a pretty severe "fire" and you can't possibly be the first one to have smelled that smoke.|||i've searched newsposts, kb's - found nothing... nothing with the exact same error, but in combination with other services...|||found it!

- rename main admin account back to main setting (administrator)
- re-install sp3a (sql)

now it works fine! :D