简体   繁体   English

如何在SQL Server中删除存储过程的版本

[英]How to DROP a version of a Stored Procedure in SQL Server

We have some legacy stored procedures that use the now deprecated feature of SQL Server that allowed you to create multiple versions of a procedure within a procedure. 我们有一些旧式存储过程,这些存储过程使用了SQL Server现在不推荐使用的功能,使您可以在过程中创建过程的多个版本。

For instance we have.. 例如我们有..

[up_MyProc]
[up_MyProc];2

You can still create these "versions" by appending the version on the end of the name. 您仍然可以通过在名称末尾附加版本来创建这些“版本”。 However without dropping the procedure we'd like to drop the internal versions. 但是,我们不想删除该过程,而是希望删除内部版本。

You cant seem to do 你似乎做不到

DROP PROC [up_MyProc];2
DROP PROC [up_MyProc;2]

Is there a way to drop the internal versions? 有没有办法删除内部版本?

Unfortunately, no. 抱歉不行。

I've just tried sp_rename which failed too. 我刚刚尝试了sp_rename ,它也失败了。

The new system views do not detect them either 新的系统视图也不会检测到它们

CREATE PROC DBO.FOO;1
AS
SELECT 1
go

CREATE PROC DBO.FOO;2
AS
SELECT 2
go

--Can't find using new system views
SELECT * FROM sys.objects WHERE name LIKE '%foo%'
SELECT * FROM sys.sql_modules WHERE definition LIKE '%dbo.foo%SELECT%'
GO
--Found using legacy "system tables"
SELECT * FROM sysobjects WHERE name LIKE '%foo%'
SELECT * FROM syscomments WHERE text LIKE '%dbo.foo%SELECT%'
GO

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM