开发者

SSMS: How to sort objects by date?

开发者 https://www.devze.com 2023-01-24 15:22 出处:网络
i created a stored procedure recently, and i would like to sort the list of stored procedures by date.开发者_JS百科

i created a stored procedure recently, and i would like to sort the list of stored procedures by date.开发者_JS百科

12 years ago this was easy:

SSMS: How to sort objects by date?

What is the preferred way to accomplish this in SQL Server Management Studio?

SSMS: How to sort objects by date?

Bonus: How to sort by owner?


Answer: It's not possible.

Upate: Possible

Sometime in the intervening 9 years since i first asked this question, SSMS added the feature that was present c. 2000: Object Explorer Details:

SSMS: How to sort objects by date?

And you get the functionality of a user interface that was created 25 years ago:

SSMS: How to sort objects by date?

I understand why didn't want to let see items in a folder: it's so much work. It's easier to make the user's suffer everyday, rather than the developers once.


You'll want to right-click the database that you are interested in and select the New Query button in the toolbar. In the Query window, insert the following TSQL:

SELECT type, type_desc, name, create_date, modify_date
FROM sys.objects
GO

This gives you system objects as well so you'll have to filter it accordingly. You could always change the select statement to "SELECT *" to get a quick view of the other columns available.

I wanted to give you the starting point and you can go where you want with it.


i am not sure if it's preferred or not but, i guess you can insert the result table into a temptable and write a select query for that table with the order by.

downside, you have to write the column names and types every time.

declare @temptable table(Name nvarchar(50),Owner nvarchar(50),Type nvarchar(50),CreateDate DateTime) insert into @temptable your_procedure select * from @temptable order by CreateDate desc


In SSMS, you can go to "Object Explorer Details" (F7 in 2008, menu in 2005/2008)

You have a choice of details view, you can see the create date.

MSDN

I suspect it isn't what you want though... and I don't know it it works with SQL Server 2000

0

精彩评论

暂无评论...
验证码 换一张
取 消