Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Script Library
 Database Object Description

Author  Topic 

joldham
Wiseass Yak Posting Master

300 Posts

Posted - 2002-03-27 : 12:21:48
Below is a script to create a table, view and sp to allow you to use sysobjects to assign a description to your objects. See the following post for other suggestions to accomplish the same. (
[url]http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=14305[/url]) I will eventually add code to delete the entry in the sysobjdesc table when an object is deleted from the sysobjects table.

Please let me know if you have any comments or suggestions.

CREATE TABLE sysobjdesc
(id int IDENTITY(1,1),
objectid int,
object_description varchar(4000),
datemodified datetime,
modified_by int)
GO

CREATE VIEW OBJECT_DESCRIPTIONS_VU
as
SELECT a.name, b.objectid, b.object_description, b.datemodified, user_name(b.modified_by) Modified_by
from dbo.sysobjects a, sysobjdesc b
WHERE a.id = b.objectid
GO

Create Procedure usp_insert_object_desc
@objname varchar(255),
@objdesc varchar(4000)
AS
DECLARE @objid int
SELECT @objid = id
FROM dbo.sysobjects
WHERE name = @objname

INSERT INTO sysobjdesc
VALUES (@objid, @objdesc, getdate(), user_id(system_USER))
Go

Jeremy

   

- Advertisement -