Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System table Documentation

Status
Not open for further replies.

bob120579

Programmer
Feb 9, 2005
42
US
I am trying to create a stored procedure based on looking up information in system tables. I am pulling basic information such as Table name, records, field names, field types etc which is the source of data for an SSRS report. This is currently working fine. There is a request to add fields that will calculate totals for each field...for instance if there is a table with an Amount column, they would like to see the total of all the values in that table's column. What is the best way to get these totals for these fields without using a cursor?

I was thinking of selecting all of the numeric fields into a temp table, selecting the top 1 record from the temp table and getting the table and column name. Then running a sum on that column in the database based on dynamic SQL and updating the documentation table accordingly. Then deleting that record from the temp table after and reading the next top record, which would bypass the cursor.

Any other ideas?

Thanks
 
By system tables, do you mean SQL Server System Tables, or tables for your Information System?
 
SQL Server...The tables that I am pulling from are syscolumns, sysobjects, sysindexes, systypes, sysowners...etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top