ExamNotes.net  -  IT certification portal

ForumsCertResearchTop sitesNewslettersFree email
HomeRegister
Exams Notes
Practice exams
Exam games
Questions by email
Online training
Training videos
College degrees
Boot camps
Book store
Links directory
Tell a friend
For webmasters

CompTIA Exam Vouchers
Save money on CompTIA exams
Question of the day
Sign up to receive
interactive practice questions
for MCSE, CompTIA
Cisco and other exams
TestKing
Get MCSE, MCSD, CCNA, CCNP,A+, N+ and many more

* ExamSheets *
Guide for Success!
Actual Questions & Answers
MCSE, MCSD, A+ ,CCNA, CCNP
Oracle 8i, Oracle 9i

Online practice tests

Certification sites

Online university

Online college

Online education

Distance learning

Software forum

Server administration forum

Programming resources






This is interesting: Free IT Magazines | Databases help forum



Microsoft (MCSE, MCSD, MOUS, MCAD) > SQL server exams > Triggers better than stored procedures?

Show a Printable Version
Email This Page to Someone!
Receive updates to this thread




Click here for list of SQL 2000 study guides



Author Triggers better than stored procedures?
sjgross
Junior Member
F




Registered: Nov 2002
Location:
Country: United States
State:
Certifications:
Working on: MCP, MCDBA

Total Posts: 29
Question Triggers better than stored procedures?

I'm currently studying for 70-229 and in reading one of my books, Professional SQL Server 2000 Database Design, the author states that triggers are better than stored procedures for dealing with inter-row or inter-table dependencies.

I'm trying to find out why that is. Can anyone help with this question?

Thanks,

Susan

http://ix.1sound.com/dbagirl
My blog for studying for MS 70-229 (Notes and Links)

Report this post to a moderator

Old Post 12-13-02 05:36 PM
sjgross is offline Click Here to See the Profile for sjgross Click here to Send sjgross a Private Message Add sjgross to your buddy list Find more posts by sjgross Reply w/Quote Edit/Delete Message IP: Logged
2lazybutsmart
The Game Never Ends




Registered: Jun 2002
Location: Toronto
Country: Canada
State:
Certifications: MCSD, MCP
Working on: MCSD.net, MCDBA, MCT

Total Posts: 684

When enforcing business rules, SQL server provides two primary mechanisms for that: constraints and triggers. Triggers are different from SP's in that they are commands executed when a certain insert, update, or delete actions happens to a table or view. Triggers are not executed by users, instead, they are executed automatically when a certain action happens.

Stored Procedures, on the other hand, are a set of statements compiled into a batch and executed together by a user. You can have tens of hundereds of actions happening in one SP. Stored procedures are usefull because they reduce network traffic since they are executed on the server. SP's can be modified independently of an application and can be used as a security mechanisim. That is so becuase users can be granted permission to execute a stored procedure even if they do not have permission to execute the procedure's statements directly.

Now, lemme get back 2 ur question. Inter-row and Inter-Table dependecies are actions happening in tables or between tables. Triggers are the best option to use in such cases.

For Example, You want to flag a product in your products table "Out-of-Stock" when you the number of products in stock is equal to zero. And you might want to place an order and add a record in the "VendorOrders" table automatically. All this action must happen without user interaction. Now, you can use SP's or you can even execute the statements directly from your application. But this is not a good way of doing it. This is where triggers are much better, more reliable, and more secure than SP's or batch-statements.

I hope your not confused
cheers,
2lazybutsmart

__________________
Crime is Common, Logic is Rare.
TechExams.net moderator

Report this post to a moderator

Old Post 12-14-02 07:25 AM
2lazybutsmart is offline Click Here to See the Profile for 2lazybutsmart Click here to Send 2lazybutsmart a Private Message Add 2lazybutsmart to your buddy list Find more posts by 2lazybutsmart Reply w/Quote Edit/Delete Message IP: Logged
sjgross
Junior Member
F




Registered: Nov 2002
Location:
Country: United States
State:
Certifications:
Working on: MCP, MCDBA

Total Posts: 29

Thanks 2lazybutsmart!

Triggers would also be faster as well as more secure, wouldn't they?

Best,

Susan

http://ix.1sound.com/dbagirl
My blog for studying for MS 70-229 (Notes and Links)

__________________
Best,

Susan
My Weblog about studying for MS 70-229 (Notes and Links)
http://ix.1sound.com/dbagirl

Report this post to a moderator

Old Post 12-16-02 02:14 AM
sjgross is offline Click Here to See the Profile for sjgross Click here to Send sjgross a Private Message Add sjgross to your buddy list Find more posts by sjgross Reply w/Quote Edit/Delete Message IP: Logged
All times are GMT.
Post new thread   Post reply

MCSE exam notes



Forum Jump:
Rate This Thread:
Forum Rules:
Who Can Read The Forum? Any registered user or guest.
Who Can Post New Topics? Any registered user.
Who Can Post Replies? Any registered user.
Changes: Messages can be edited by their author.
Posts: HTML code is OFF. Smilies are ON. vB code is ON. [IMG] code is ON.
 

ExamNotes forum archive


Powered by: vBulletin 2.2.8
Copyright ©2000, Jelsoft Enterprises Limited.

  Free Braindumps | mcse braindumps