在 SQL Server Management Studio 2014 中,新触发器菜单选项被禁用

In SQL Server Management Studio 2014, the New Trigger menu option is disabled(在 SQL Server Management Studio 2014 中,新触发器菜单选项被禁用)
本文介绍了在 SQL Server Management Studio 2014 中,新触发器菜单选项被禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的表中添加一个新触发器.如图所示,New Trigger 按钮未激活.新索引、新列、新约束、新静态变量处于活动状态.

I want to add a new trigger to my table. As seen in the picture, New Trigger button is not active. new index, new column, new contraints, new statics is active.

我不明白是什么问题.

推荐答案

您不需要使用菜单项来创建触发器.只需打开一个查询窗口并在那里编写 create trigger 语句.

You don't need to use the menu item to create a trigger. Just open up a query window and write the create trigger statement there.

要获得语法方面的帮助,您可以在编辑器中使用片段.右键单击查询编辑器的表面并选择插入片段",然后选择触发器"和创建触发器"以将以下代码片段插入到您的编辑器中.

To get some help with the syntax you can use a snippet in the editor. Right click on the surface of the query editor and select Insert Snippet and then select Trigger and Create Trigger to get the following code snippet inserted to your editor.

CREATE TRIGGER TriggerName
    ON [dbo].[TableName]
    FOR DELETE, INSERT, UPDATE
    AS
    BEGIN
    SET NOCOUNT ON
    END

菜单项(如果你让它工作的话)几乎会做同样的事情,只是它会使用一个看起来像这样的模板:

The menu item (if you get it to work) will do almost the same thing only it will use a template that looks like this:

-- ================================================
-- 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:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE TRIGGER <Schema_Name, sysname, Schema_Name>.<Trigger_Name, sysname, Trigger_Name> 
   ON  <Schema_Name, sysname, Schema_Name>.<Table_Name, sysname, Table_Name> 
   AFTER <Data_Modification_Statements, , INSERT,DELETE,UPDATE>
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

这篇关于在 SQL Server Management Studio 2014 中,新触发器菜单选项被禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
SSIS: Model design issue causing duplications - can two fact tables be connected?(SSIS:模型设计问题导致重复-两个事实表可以连接吗?)
SQL Server Graph Database - shortest path using multiple edge types(SQL Server图形数据库-使用多种边类型的最短路径)
Invalid column name when using EF Core filtered includes(使用EF核心过滤包括时无效的列名)
How should make faster SQL Server filtering procedure with many parameters(如何让多参数的SQL Server过滤程序更快)
How can I generate an entity–relationship (ER) diagram of a database using Microsoft SQL Server Management Studio?(如何使用Microsoft SQL Server Management Studio生成数据库的实体关系(ER)图?)