如何在 SQL Server Management Studio 中订购项目解决方案内容
在针对 SQL Server 2005 运行的 SQL Server Management Studio (SSMS) 中,我有一个包含许多视图的解决方案。
这些视图不按字母顺序排序。
任何人都可以提供原因的解释,或者按字母顺序排序的解决方案吗?
In SQL Server Management Studio (SSMS) running against SQL Server 2005, I have a solution which contains a number of views.
These views are not sorted alphabetically.
Can anyone provide either an explanation of why, or a solution to order them alphabetically ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
我刚刚遇到这个 论坛帖子。 事情并没有变得更简单。
I just came across this forum post. It doesn't get any simpler.
您可以安装一个工具来对 SQL Server 解决方案项目的内容进行排序。
请参阅以下参考资料。
http://web.archive.org/web/20121019155526/http://www.sqldbatips.com/showarticle.asp?ID=78" archive.org/web/20121019155526/http://www.sqldbatips.com/showarticle.asp?ID=78
请确保在尝试排序之前保存您的工作。
There is a tool that you can install to sort the contents of a SQL Server Solution project.
See the following reference.
http://web.archive.org/web/20121019155526/http://www.sqldbatips.com/showarticle.asp?ID=78
Please ensure you save your work, before attempting a sort.
当您将新项目添加到项目时,它们将被添加到列表的末尾。 它们按照添加到项目的顺序保存,因为此顺序保存在相应的 *.ssmssqlproj 文件中。 要更改此顺序,请关闭项目/解决方案,然后找到 *.ssmssqlproj 文件并使用记事本或您最喜欢的 XML 编辑器对其进行编辑(始终先进行备份!)。 对 FileNode 元素及其子元素重新排序,以重新排序解决方案资源管理器中的项目外观。
When you add new item to the project they are added to the end of the list. They are kept in the order that they were added to the project because this order is preserved in the corresponding *.ssmssqlproj file. To change this order, close the project/solution, then locate the *.ssmssqlproj file and edit it with Notepad or your favorite XML editor (always make a backup first!). Reorder the FileNode elements along with their children to reorder the items appearance in the Solution Explorer.
这是我采取的解决方案。 对源代码的推荐投赞成票,但是我这里没有安装.NET,所以我不得不采用手动方法。
将所有内容 似乎已经解决了我的问题。
Here's the solution I took. Up votes for the recommendation of the source code, however I don't have .NET installed here, so I had to go for a manual approach.
That seems to have fixed my issue.
以下帖子中列出的存储过程也可以做到这一点:
http://beyondrelational.com/blogs/jacob/archive/2009/08/22/xquery-lab-48-sorting-query-files-in-sql-server-管理工作室-ssms-解决方案-project.aspx
The stored procedure listed in the following post can do it as well:
http://beyondrelational.com/blogs/jacob/archive/2009/08/22/xquery-lab-48-sorting-query-files-in-sql-server-management-studio-ssms-solution-project.aspx
请注意,排序区分大小写。
所以“B..sql”将出现在“a...sql”之前。
请记住以相同的大小写开始所有脚本(无论是小写还是大写)。
Please note that the sorting is case-sensitive.
So "B..sql" will come before "a...sql".
Remember to start all your scripts with the same casing (be it lower or upper).
另一种(我认为)更简单的编辑 ssmssqlprog 的方法是使用 MS XML Notepad 2007。这样我就可以拖动节点来对它们进行排序。 当然要复印一份。 2007 似乎是最新版本,可从...
http 获取://www.microsoft.com/en-us/download/details.aspx?id=7973
Another easier (I think) way to edit the ssmssqlprog is to do so with MS XML Notepad 2007. With that I could drag the nodes around to order them. Make a copy of course. 2007 appears to be the latest version and is available at ...
http://www.microsoft.com/en-us/download/details.aspx?id=7973
处理此问题的另一种方法是从 Management Studio 开始一个新查询(而不是通过在解决方案中选择“新查询”)。
使用好名称将查询文件保存到解决方案文件夹中。
然后将“添加现有项目”添加到解决方案中。
它会添加您选择的名称并正确排序,而不是最初将文件创建为“SQLQuery1”。
也许好不了多少,但是编辑项目文件并重新打开的另一种选择。
Another way to handle this is to start with a new query from Management Studio (not by selecting 'New Query' in the solution).
Save the query file into the solution folder with a good name.
Then 'Add Existing Item' into the solution.
It adds with your chosen name, sorted correctly instead of creating the file initially as 'SQLQuery1'.
Maybe not much better, but another option to editing the project file and reopening.
在上一个答案的基础上,您可以将其添加为解决方案中的新查询,完成后,只需将其从解决方案中删除,然后将现有项目添加到解决方案中,然后选择新查询。 这样做可以在删除并重新添加之前将新查询添加到正确的解决方案文件夹中。
Building on the previous answer, you can add it as a new query in the solution, and when you are done, just remove it from the solution and then Add existing item to the solution, and select your new query. Doing it this way adds the new query to the correct solution folder for you before you remove and add back in.
还有另一种方法……虽然其中一种方法对我有用过几次……但有时它会变得很顽固。 找到损坏的位置。 截取文件名的屏幕截图。
选择出现故障之前需要删除的所有文件名。
在其他作品中,如果它对 a - f 进行排序,然后对 b - z 进行排序
删除 bz 之前出现的所有 af(不要删除它们),然后保存项目。
现在将它们添加回并再次保存项目。 急速。
到目前为止,这对我来说效果很好,而且相当容易做到。
And yet another way... while one of these ways worked for me several times... sometimes it becomes stubborn. Find the location where it is broken. Take a screenshot of the file names.
Select all the file names you need to remove before the glitch.
in other works, if it sorts a - f and then sorts b - z
Remove all the a-f (don't delete them) that occur before the b-z, then save the project.
Now add them back in and save the project again. Presto.
So far this has worked very well for me and is fairly easy to do.