Solved

Create Trigger Error Invalid Object Name

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Slow Connectivity over ODBC 8 32
SSRS 2013 - Overlapping reports 2 19
VBScript Write Column Headers 3 34
T-SQL: "HAVING CASE" Clause 1 23
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
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…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

785 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