Home > Ask the SQL Server Experts > Greg Low - Development Questions & Answers > Problem attaching stored procedure and SQL Server trigger
Ask The SQL Server Expert: Questions & Answers
EMAIL THIS

Problem attaching stored procedure and SQL Server trigger

Greg Low EXPERT RESPONSE FROM: Greg Low

Pose a Question
Other SQL Server Categories
Meet all SQL Server Experts
Become an Expert for this site


Expert advice on database development
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 06 December 2007
I have some questions about triggers and stored procedures. I've created a stored procedure in my database (not master) which calls a .dll file using the method sp_OACreate,sp_OAGetErrorInfo,sp_OAMethod,sp_OADestroy.

All goes well when I execute it in SQL Analyzer. So, I tried to attach this stored procedure to the trigger. When a certain column in one table changes, I want the trigger to call this stored procedure. It seems easy, but when I tried it, the SQL Server instance blocked. I got a message saying there was a permissions problem of using the method sp_OACreate. I've modified the authorization, but it still won't work.

When I execute the stored procedure and trigger separately, there's no problem. Is there any difference between these two ways, or did I lose something in my test?


>
EXPERT RESPONSE
If you are using SQL Server 2005, you should look to avoid using sp_OACreate, etc. Try to replace this code with managed CLR-based code instead. In terms of permissions to the object, you will need to consider the identity of the running code as well.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
Greg Low - Development
Copy stored procedure between SQL Server 2005 databases
Should developers have permissions to SQL Server production queue?
Schedule stored procedure and save output to network drive
Query to find SQL Server database names created by users
Is it possible to find disabled indexes in SQL Server 2000?
SQL Server id permission to create and modify tables
Installing different SQL Server versions on one machine
Calling an extended stored procedure in SQL Server 2005
Multiple SQL Server instances vs. multiple databases
Executing a trigger before SQL Server table is updated

SQL Server stored procedures
SQL and SQL Server Tutorial and Reference Guide
SQL Server stored procedures tutorial: Write, tune and get examples
Check SQL Server database and log file size with this stored procedure
SQL Server source code analysis and management adds database security
Configure SQL Server Service Broker for sending stored procedure data
Find size of SQL Server tables and other objects with stored procedure
Track changes to SQL Server 2000 and 2005 with one simple utility
Troubleshoot SQL Server 2005 temporary table performance problems
Use SQL Profiler to find long running stored procedures and commands
Stored procedure to monitor long-running jobs in SQL Server 2000

SQL Server 2005 (Yukon)
SQL Server data conversions from date/time values to character types
Basics for working with DATETIME and SMALLDATETIME in SQL Server 2005
How to configure Database Mail in SQL Server 2005 to send mail
How to use rank function in SQL Server 2005
Manage traces in SQL Server 2005 Analysis Services with XMLA commands
Tutorial: SQL Server 2005 Analysis Services
Create a computed column in SQL Server using XML data
Open SSIS packages without validation using these SQL properties
Using the OUTPUT clause for practical SQL Server applications
Create DDL table in SQL Server 2005 to audit DDL trigger activity
SQL Server 2005 (Yukon) Research

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
library  (SearchSQLServer.com)
trigger  (SearchSQLServer.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice

HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2005 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts