We are currently using SQL Server 2000 but will soon be moving to 2008. I am looking for a way to group related stored procedures into folders. SQL Server 2000 does not seem to have this ability and from my searches it looks like 2008 does not either. This seems like a basic feature that most users would want. Wouldn't it make sense to put all generic stored procedures that are shared across multiple projects in one folder and project specific procs in another?
我们目前正在使用SQL Server 2000,但很快将转向2008年。我正在寻找一种将相关存储过程分组到文件夹中的方法。 SQL Server 2000似乎没有这种能力,从我的搜索看起来,2008年也没有。这似乎是大多数用户想要的基本功能。将所有在多个项目*享的通用存储过程放在一个文件夹中并将项目特定的过程放在另一个文件夹中是不是有意义?
It seems the way most devs do this now is by using some from of ID_SPNAME syntax and sorting them.
现在大多数开发人员这样做的方式是使用ID_SPNAME语法中的一些并对它们进行排序。
2 个解决方案
#1
8
Grouping procs and functions by type in the UI would be nice, but Management Studio can't do it. Using SQL Server 2000, I've done what you suggest (prefixing objects with a grouping code and sorting). In 2005 and 2008, consider creating schemas to serve the same purpose, and grouping your objects in those. Note that the object names are prefixed with the schema name in the UI.
在UI中按类型分组过程和函数会很好,但Management Studio无法做到这一点。使用SQL Server 2000,我已经完成了你的建议(使用分组代码和排序为对象添加前缀)。在2005年和2008年,考虑创建模式以实现相同的目的,并将对象分组。请注意,对象名称以UI中的架构名称为前缀。
CREATE SCHEMA ShoppingCart AUTHORIZATION Joe
CREATE PROCEDURE AddItem ...
... will display in the UI as ShoppingCart.AddItem
.
...将在UI中显示为ShoppingCart.AddItem。
Sql Server 2008中的模式
#2
8
The most common way to do this (in SQL 2005/2008) is by using schemas:
最常见的方法(在SQL 2005/2008中)是使用模式:
HR.spCalculateEmployeeCompensation
HR.spCalculateContractorBonus
Web.spAppendWebLog
Web.spUserEndSession
Reporting.spGetCurrentYearSummary
Reporting.spGetLastMonthDetail
Not only will these visually organize themselves in the SSMS list, but you can apply different permissions to each schema.
这些不仅可以在SSMS列表中直观地组织自己,还可以对每个模式应用不同的权限。
#1
8
Grouping procs and functions by type in the UI would be nice, but Management Studio can't do it. Using SQL Server 2000, I've done what you suggest (prefixing objects with a grouping code and sorting). In 2005 and 2008, consider creating schemas to serve the same purpose, and grouping your objects in those. Note that the object names are prefixed with the schema name in the UI.
在UI中按类型分组过程和函数会很好,但Management Studio无法做到这一点。使用SQL Server 2000,我已经完成了你的建议(使用分组代码和排序为对象添加前缀)。在2005年和2008年,考虑创建模式以实现相同的目的,并将对象分组。请注意,对象名称以UI中的架构名称为前缀。
CREATE SCHEMA ShoppingCart AUTHORIZATION Joe
CREATE PROCEDURE AddItem ...
... will display in the UI as ShoppingCart.AddItem
.
...将在UI中显示为ShoppingCart.AddItem。
Sql Server 2008中的模式
#2
8
The most common way to do this (in SQL 2005/2008) is by using schemas:
最常见的方法(在SQL 2005/2008中)是使用模式:
HR.spCalculateEmployeeCompensation
HR.spCalculateContractorBonus
Web.spAppendWebLog
Web.spUserEndSession
Reporting.spGetCurrentYearSummary
Reporting.spGetLastMonthDetail
Not only will these visually organize themselves in the SSMS list, but you can apply different permissions to each schema.
这些不仅可以在SSMS列表中直观地组织自己,还可以对每个模式应用不同的权限。