Solved

Create Trigger Error Invalid Object Name

Posted on 2007-03-19
6
1,859 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

630 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