0
我想在表上插入時使用觸發器,但由於錯誤我無法創建它。在T-SQL中編寫基本的觸發器
-- ================================================
-- 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: Nick Gowdy
-- Create date: 26/03/2013
-- Description: Insert Module ID into table based on User ID on update
-- =============================================
CREATE TRIGGER TblAuditLogLoggingIn.ModuleID ON dbo.GenesisOnline.TblAuditLogLoggingIn.UserID
AFTER INSERT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for trigger here
END
GO
錯誤是:
消息8197,級別16,狀態4,過程的moduleId,第6行 對象 'TblAuditLogLoggingIn.UserID' 不存在或爲這種操作無效。
架構是dbo.GenesisOnline.TblAuditLogLoggingIn和欄目有:
- AuditID PK
- 用戶名
- 的moduleId
- LoggedInDate
觸發我想創建的是我創建的表TblAuditLogLoggingIn。但管理工作室說它不存在?
上是否存在TblAuditLogLoggingIn用戶名? – 2013-03-26 09:52:14
該表屬於哪個模式? – ChrisBint 2013-03-26 09:52:27
查看我更新的帖子,查找您的問題的答案。 – 2013-03-26 10:02:44