Solved

Create Trigger Error Invalid Object Name

Posted on 2007-03-19
6
1,807 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how the fundamental information of how to create a table.

679 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