Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Database Documentation


Database Documentation

Author
Message
HBhagat
HBhagat
Mr or Mrs. 500
Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)

Group: General Forum Members
Points: 576 Visits: 935
Hi,
I am planning to add the database details into a word document.
I have created tables to store basic information from system tables.
I want to write the details into word file.

Example.
Table Name Table_Description Column Column_descript
MyTable This is my table Col1 this is col1
Col2 this is col2
Col3 this is col3

Table Name Table_Description Column Column_descript
MyTable_1 This is my table2 Col1 this is col2
Col2 this is col2
Col3 this is col2

I want to put all the above data into word document.
Is it possible to write this data via sql server 2000?

Thanks for the help.. :-)
Lowell
Lowell
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19126 Visits: 39461
actually, what a lot of people do is to put the data in the database itself by using extended properties...(sys.sp_addextendedproperty / fn_listextendedproperty)

you can put descriptions up to 255 chars in length i think about the database, separate descriptions about objects like proc/views/tables, and separate descriptions about each column...
then you read those descriptions back and put them in the presentation document of your choice(word...excel...html...whatever)

here's a simple example about a single stored procedure; play with it and see how the same concept can be used for every database object.

CREATE procedure [dbo].[sp_find]
@findcolumn varchar(50)
as
begin
set nocount on
select sysobjects.name as TableFound,syscolumns.name as ColumnFound
from sysobjects
inner join syscolumns on sysobjects.id=syscolumns.id
where sysobjects.xtype='U'
and (syscolumns.name like '%' + @findcolumn +'%'
or sysobjects.name like '%' + @findcolumn +'%' )
order by TableFound,ColumnFound
end
GO
EXEC sys.sp_addextendedproperty
@name = N'Version',
@value = N'9.0.154.90',
@level0type = N'SCHEMA', @level0name = 'dbo',
@level1type = N'PROCEDURE', @level1name = 'sp_find';
EXEC sys.sp_addextendedproperty
@name = N'Purpose',
@value = N'simple tool to find column or table names that are LIKE the inputed value',
@level0type = N'SCHEMA', @level0name = 'dbo',
@level1type = N'PROCEDURE', @level1name = 'sp_find';
--show all extended properties
SELECT objtype, objname, name, value
FROM fn_listextendedproperty (NULL, 'schema', 'dbo', 'PROCEDURE', 'sp_find', NULL, NULL);
--get just the "Version" that i created:
SELECT objtype, objname, name, value
FROM fn_listextendedproperty ('Version', 'schema', 'dbo', 'PROCEDURE', 'sp_find', NULL, NULL);



Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Lowell
Lowell
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19126 Visits: 39461
additionally, both Enterprise Manager and SSMS GUIS's have the built in ability to add an extended property for ease of use: just go to teh table and select "Design", one of the values is teh "Description"



Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

HBhagat
HBhagat
Mr or Mrs. 500
Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)

Group: General Forum Members
Points: 576 Visits: 935
Thank you for the reply,
But I think I am not being able to make clear what I actually want.

In simple terms I want to document the database into word file. I work in sql server 2000.

I want to write a procedure or generate a script which I execute it and then a word file gets created with all the tables and its column explanation.

Thanks,
Harsha
Lowell
Lowell
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19126 Visits: 39461
yes, i understood that...
what i was telling you is compared to what i would call a "normal" process, you are doing it backwards...you put the data in the database, and then read the data into word or whatever

Word documents are not a standard format, so if you do anything fancy like adding tables to structure organize, bold fonts,a dd headers, etc, it's no longer easy for a machine to read.
because of those formatting issues, you would have to make an SSIS package to try to read your word document, parse it, and then create the commands i mentioned previously.
I'd avoid word altogether and use plain text so you could import it via BULK INSERT if you HAVE to do it from doc to the database.

I was just trying to offer information, and maybe a better strategy, based on my experience.

Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Lowell
Lowell
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19126 Visits: 39461
harsha.bhagat1 (3/1/2011)
Thank you for the reply,
But I think I am not being able to make clear what I actually want.

In simple terms I want to document the database into word file. I work in sql server 2000.

I want to write a procedure or generate a script which I execute it and then a word file gets created with all the tables and its column explanation.

Thanks,
Harsha


or maybe you wanted to just generate the lsit of tables/columns like this?:
select objz.name as TableName,
colz.name as ColumnName,
colz.colid
from sysobjects objz
inner join syscolumns colz
on objz.id = colz.id
WHERE objz.xtype='U'
ORDER BY objz.name,colz.colid



Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

HBhagat
HBhagat
Mr or Mrs. 500
Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)

Group: General Forum Members
Points: 576 Visits: 935
I have created a procedure as proc_Admin_table_ColumnDescription.
When I exeute this procedure it returns me with the table and column description in result pane, which is fine. But I want this result to in MS Word but not like a plain list but in a tabular form for each table.
HBhagat
HBhagat
Mr or Mrs. 500
Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)Mr or Mrs. 500 (576 reputation)

Group: General Forum Members
Points: 576 Visits: 935
Is there a any way that I can put the data into MS Word via sql statements??

Searching on net, finding sometihng called sp_oacreate, method..
Any idea about this ..
SSIS Guy
SSIS Guy
Valued Member
Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)

Group: General Forum Members
Points: 69 Visits: 175
Here is one more Free Tool to document Sql Server
pitt
pitt
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 11
Try Dataedo - you can describe tables, views and functions/procedures. Cool thing is you can format text and paste images and group objects into modules.
See http://dataedo.com
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search