Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Should I Write Triggers

Author  Topic 

ravininave
Posting Yak Master

111 Posts

Posted - 2010-04-03 : 23:36:29
I'm uploading some data onto my server. After uploading some figures I've to Calculate some brokarage and update some other tables. Should I use On Update Triggers or should I write code in my ASP.NET. I haven't used Trigger ever before. Suggest me the Best.


VB6/ASP.NET
------------------------
http://www.nehasoftec.com

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-04 : 01:24:19
I wouldn't use either. I would instead use stored procedures.

Is this a onetime upload? If it is, then just use T-SQL in a new query window in Management Studio.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-04 : 02:05:09
is the uploading done by some job? if yes, as Tara suggested write a procedure with your logic to Calculate the brokarage and update some other tables and then make it the next step of the job.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ravininave
Posting Yak Master

111 Posts

Posted - 2010-04-04 : 21:53:56
quote:
Originally posted by visakh16

is the uploading done by some job? if yes, as Tara suggested write a procedure with your logic to Calculate the brokarage and update some other tables and then make it the next step of the job.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





Well, I've to calculate brokerage whenever user uploads some data. This calculations would be quite heavy when data would increase. So I'm thinking about to write some triggers. If I would write some procedures and call it from CodeBehind then I'm thinking that it would take more time

VB6/ASP.NET
------------------------
http://www.nehasoftec.com
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-04 : 23:19:10
Stored procedures do not take more time. We do all of our queries in stored procedures. We don't use any triggers. On one system, I have 3000 queries happening per second.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -