This is a discussion on Re: triggers with non existence table reference within the SQL Server forums, part of the Microsoft SQL Server category; --> You could try using the meta-data tables (1) if exists (select 1 from information_schema.tables where table_name = 'OutputHeaderStatusHistory' and ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| You could try using the meta-data tables (1) if exists (select 1 from information_schema.tables where table_name = 'OutputHeaderStatusHistory' and table_type = 'BASE TABLE') (2) if exists (select 1 from sysobjects where name = 'OutputHeaderStatusHistory' and xtype = 'U') INSERT INTO OutputHeaderStatusHistory (OutputHdrRef, WorkflowStatusRef, UserRef, ChangeDate) SELECT OutputHdrRef, WorkflowStatusRef, LastUpdateUserRef, LastUpdateDate FROM INSERTED WHERE WorkflowStatusRef in(3,5,7) -- Awaiting Export, exporting, awaiting settlement GO |
| ||||
| thanks Mystery Man What I needed to know was if there is a flag in the administration of SQL Server that turns off messages about non existence tables when the trigger is run into the database for the first time? thanks PromisedOyster@hotmail.com (Mystery Man) wrote in message news:<87c81238.0306300443.1de481d5@posting.google. com>... > You could try using the meta-data tables > > (1) if exists (select 1 from information_schema.tables where > table_name = 'OutputHeaderStatusHistory' and table_type = 'BASE > TABLE') > > (2) if exists (select 1 from sysobjects where name = > 'OutputHeaderStatusHistory' and xtype = 'U') > > INSERT INTO OutputHeaderStatusHistory > (OutputHdrRef, WorkflowStatusRef, UserRef, ChangeDate) > SELECT OutputHdrRef, WorkflowStatusRef, LastUpdateUserRef, > LastUpdateDate > FROM INSERTED > WHERE WorkflowStatusRef in(3,5,7) -- Awaiting Export, exporting, > awaiting settlement > GO |