当前位置: 动力学知识库 > 问答 > 编程问答 >

database - How to systematically manage a Big List of Queries and Tables in SQL Server?

问题描述:

Suppose someone has to work on a lot of different SQL Server Databases which have got a lot of Tables and Queries / Views inside them.

After a period of time, it becomes very difficult to remember exactly what kind of columns are present within a given Table and View.

Please suggest some method by which one can keep a systematic list of all the Tables and Views that are present within a SQL Server Database, along with the columns that are present within them.

Are there any Add-on products or services etc. available that helps in making this type of work systematic?

Currently I add comments to each queries inside SQL Server to remind me of what this query is doing, but this method is not great. I am looking for some better and more efficient methods.

Please share any ideas that you might have in this direction.

Thanks a lot

网友答案:

You may find the following useful for each database.

select s.name, s.type, c.name , s.refdate 
  from syscolumns c 
 inner join sysobjects s on s.id = c.id  
 where s.xtype in('U','V') 
 order by s.refdate --use refdate for manual quick looks 
   --  use s.name for file output and long term analysis

I output this to text files with the exact same format and check them into source control for each database. I even make comments about fields as things change. This is not part of the formal process, it is just sanity big picture version tracking independent of the formal deployments.

分享给朋友:
您可能感兴趣的文章:
随机阅读: