如何在 SQL 服务器中更改存储过程时添加 header 注释
How to add header comments when altering stored procedures in SQL Server
我有一个没有 header 注释的存储过程。我想添加它们,但每次我尝试时,它都不包括在内。
在 SQL Server Management Studio I 中:
1.Right-click我的存储过程点击修改
USE [ABigDB]
GO
/****** Object: StoredProcedure [dbo].[spDoWork] Script Date: 21/08/2015 14:11:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spDoWork]
@Id uniqueidentifier,
@Session nvarchar(50),
@XMLData xml
WITH EXECUTE AS OWNER
AS
BEGIN
--etc etc...
END
2.I 在存储过程和 运行 脚本上方粘贴注释:
-- Stored Procedure
-- Author: Dave
-- Create date: 21/08/2015
-- Description: Does Stuff
-- Change history
-- 07/08/2015 - Overlord - Done stuff
-- 06/08/2015 - Kerrigan - Done more stuff
USE [ABigDB]
GO
/****** Object: StoredProcedure [dbo].[spDoWork] Script Date: 21/08/2015 14:11:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spDoWork]
@Id uniqueidentifier,
@Session nvarchar(50),
@XMLData xml
WITH EXECUTE AS OWNER
AS
BEGIN
--etc etc...
END
3.When 我修改了它显示的同一个存储过程:
USE [ABigDB]
GO
/****** Object: StoredProcedure [dbo].[spDoWork] Script Date: 21/08/2015 14:11:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spDoWork]
@Id uniqueidentifier,
@Session nvarchar(50),
@XMLData xml
WITH EXECUTE AS OWNER
AS
BEGIN
--etc etc...
END
那么如何让评论出现在那里?
我通过执行以下操作解决了它:
USE [ABigDB]
GO
/****** Object: StoredProcedure [dbo].[spDoWork] Script Date: 21/08/2015 14:11:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- Stored Procedure
-- Author: Dave
-- Create date: 21/08/2015
-- Description: Does Stuff
-- Change history
-- 07/08/2015 - Overlord - Done stuff
-- 06/08/2015 - Kerrigan - Done more stuff
ALTER PROCEDURE [dbo].[spDoWork]
@Id uniqueidentifier,
@Session nvarchar(50),
@XMLData xml
WITH EXECUTE AS OWNER
AS
BEGIN
--etc etc...
END
考虑将 addition 中的元数据用于您的过程、表格、列等,以用于文档目的。
查看以下有助于查看数据库对象的内容。
Is it possible to add a description/comment to a table in Microsoft SQL 2000+
我有一个没有 header 注释的存储过程。我想添加它们,但每次我尝试时,它都不包括在内。
在 SQL Server Management Studio I 中:
1.Right-click我的存储过程点击修改
USE [ABigDB]
GO
/****** Object: StoredProcedure [dbo].[spDoWork] Script Date: 21/08/2015 14:11:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spDoWork]
@Id uniqueidentifier,
@Session nvarchar(50),
@XMLData xml
WITH EXECUTE AS OWNER
AS
BEGIN
--etc etc...
END
2.I 在存储过程和 运行 脚本上方粘贴注释:
-- Stored Procedure
-- Author: Dave
-- Create date: 21/08/2015
-- Description: Does Stuff
-- Change history
-- 07/08/2015 - Overlord - Done stuff
-- 06/08/2015 - Kerrigan - Done more stuff
USE [ABigDB]
GO
/****** Object: StoredProcedure [dbo].[spDoWork] Script Date: 21/08/2015 14:11:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spDoWork]
@Id uniqueidentifier,
@Session nvarchar(50),
@XMLData xml
WITH EXECUTE AS OWNER
AS
BEGIN
--etc etc...
END
3.When 我修改了它显示的同一个存储过程:
USE [ABigDB]
GO
/****** Object: StoredProcedure [dbo].[spDoWork] Script Date: 21/08/2015 14:11:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spDoWork]
@Id uniqueidentifier,
@Session nvarchar(50),
@XMLData xml
WITH EXECUTE AS OWNER
AS
BEGIN
--etc etc...
END
那么如何让评论出现在那里?
我通过执行以下操作解决了它:
USE [ABigDB]
GO
/****** Object: StoredProcedure [dbo].[spDoWork] Script Date: 21/08/2015 14:11:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- Stored Procedure
-- Author: Dave
-- Create date: 21/08/2015
-- Description: Does Stuff
-- Change history
-- 07/08/2015 - Overlord - Done stuff
-- 06/08/2015 - Kerrigan - Done more stuff
ALTER PROCEDURE [dbo].[spDoWork]
@Id uniqueidentifier,
@Session nvarchar(50),
@XMLData xml
WITH EXECUTE AS OWNER
AS
BEGIN
--etc etc...
END
考虑将 addition 中的元数据用于您的过程、表格、列等,以用于文档目的。
查看以下有助于查看数据库对象的内容。
Is it possible to add a description/comment to a table in Microsoft SQL 2000+