gpt4 book ai didi

sql - 在SQL Server中更改存储过程时如何添加 header 注释

转载 作者:行者123 更新时间:2023-12-04 13:59:25 24 4
gpt4 key购买 nike

我有一个没有标题注释的存储过程。我想添加它们,但是每当尝试尝试时,它都不包括在内。

在SQL Server Management Studio I中:

1.右键单击我的存储过程,然后单击修改

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.我将注释粘贴到存储过程上方并运行脚本:
-- 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.当我修改相同的存储过程时,它显示为:
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

关于sql - 在SQL Server中更改存储过程时如何添加 header 注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32141147/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com