Solved

Create Trigger Error Invalid Object Name

Posted on 2007-03-19
6
1,754 Views
Last Modified: 2008-01-09
I have my trigger setup and ready to go, but when I try to create it I get the error:

Msg 208, Level 16, State 4, Procedure dbo.STEP1push, Line 10
Invalid object name 'dbo.CO_DES_QUEUE'.

That table exists, so I have no idea why this is not working.  I used the create trigger template in SQL Server Management Studio.  It should be noted, however, that this is on SQL Server 2000.

Here is the trigger:

-- ================================================
-- Template generated from Template Explorer using:
-- Create Trigger (New Menu).SQL
--
-- Use the Specify Values for Template Parameters
-- command (Ctrl-Shift-M) to fill in the parameter
-- values below.
--
-- See additional Create Trigger templates for more
-- examples of different Trigger statements.
--
-- This block of comments will not be included in
-- the definition of the function.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:            Paul Huff
-- Create date: 03/19/2007
-- Description:      On INSERT (new job being configured) will create an OLE
--                        object to our strongly named .NET component and call it.
--                        This component is the publisher object in our design
--                        automation process which uses Subscriber/Publisher pattern
--                        to push new jobs to the baby ENG servers.
-- =============================================
CREATE TRIGGER "dbo.STEP1push"
   ON "dbo.CO_DES_QUEUE"
   AFTER INSERT
AS
BEGIN
      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.
      SET NOCOUNT ON;

    -- DECLARE needed variables
      DECLARE  @ExecutionResult INT, @errorSource VARCHAR(100), @errorDescription VARCHAR(100)
                   , @result VARCHAR(200), @hnd INT, @quoteNumber VARCHAR(10), @designID INT
 
      -- Get design id from INSERT command and then get the quote number
      SELECT @designID = "DESIGN_ID" FROM "INSERTED"
      SELECT @quoteNumber = "DESIGN_INPUT" FROM "dbo.CO_DES_INPUT" WHERE "INPUT_NAME" = 'QuoteNumber' AND "DESIGN_ID" = @designID

      -- EXECUTE the system stored procedure to create our OLE object and
      -- call the appropriate method from the .NET dll.
      EXEC @ExecutionResult = sp_OACreate 'STEP1.AutoDesign.Publisher.CDesignPush', @hnd OUTPUT
      IF (@ExecutionResult <> 0)
      BEGIN
              EXEC sp_OAGetErrorInfo @hnd, @errorSource OUTPUT, @errorDescription OUTPUT
              SELECT @errorSource, @errorDescription
      END
      
      -- EXECUTE the system stored procedure to call the method to execute a push
      EXEC @ExecutionResult = sp_OAMethod @hnd, 'pushDesign', @result OUTPUT, @designID, @quoteNumber
      IF (@ExecutionResult <> 0)
      BEGIN
              EXEC sp_OAGetErrorInfo @hnd, @errorSource OUTPUT, @errorDescription OUTPUT
              SELECT @errorSource, @errorDescription
      END
      
      EXEC @ExecutionResult = sp_OADestroy @hnd
      IF (@ExecutionResult <> 0)
      BEGIN
              EXEC sp_OAGetErrorInfo @hnd, @errorSource OUTPUT, @errorDescription OUTPUT
      
              SELECT @errorSource, @errorDescription
      END
      
      SELECT @result
      

END
GO

0
Comment
Question by:phuff34
  • 2
  • 2
6 Comments
 
LVL 10

Expert Comment

by:lahousden
ID: 18752069
<<...That table exists...>> - are you sure, however, that it is indeed owned by "dbo"?  If it is owned by another user then you will need to change the "dbo" to the other user name.
0
 

Author Comment

by:phuff34
ID: 18752104
Yes it does exist and it is owned by dbo.  In fact, I just dragged the table from the tree view into the code to eliminate typos.
0
 

Accepted Solution

by:
phuff34 earned 0 total points
ID: 18752190
Problem solved.

I had to add a

use [Concept608] (which is the database name)

to the beginning.  You would have thought it would have been assumed.  Oh well.  Thanks anyway
0
 
LVL 10

Expert Comment

by:lahousden
ID: 18753494
No wurries! ;)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now