System Tables and Catalog Views by Inexpensive Software Computers - Inexpensive Software Computers
Search Inexpensive Software Computers
Basket
0 Items
($0)
   CLICK BELOW FOR LIVE CHAT
    
TESTED 24 MAY
  System Tables and Catalog Views by Inexpensive Software Computers   Welcome Guest LOGIN |  CREATE NEW ACCOUNT |  MY ACCOUNT  |  CART CONTENTS  |  CHECKOUT   

Main Categories
Inexpensive SSL Cert

Inexpensive Software Computers is encrypted with 128bit ssl for secure credit card transactions.

System Tables and Catalog Views by Inexpensive Software Computers
by Inexpensive Software Computers
     
     

System Tables and Catalog Views

When a new version is released or when existing software is upgraded there is always a learning curve and getting used to new ways of doing things. This article demonstrates how to use SQL Server 2005's catalog views in comparison with using system tables in SQL Server 2000.

Catalog views are a storehouse for static metadata. They contain data about the server, database, objects, logins, permissions, etc.

Catalog views are the general interface to the catalog metadata, and we should start using them rather than accessing the system tables directly.

Find all columns in a table that are computed columns

SQL SERVER 2000:

select name from syscolumns 
   where id =object_id('TableName') 
   and iscomputed=1

SQL SERVER 2005:

select name from sys.computed_columns 
   where object_id =object_id('TableName')

Note: The computed column in SQL Server 2005 may be persisted. To narrow down the result set, you could execute the following query:

select * from sys.computed_columns 
   where is_persisted=0

Find all tables that have columns with an identity property

SQL SERVER 2000:

select object_name(id),name from syscolumns 
 where columnproperty(id,name,'IsIdentity')=1 

SQLSERVER 2005:

select object_name(object_id),name 
 from sys.identity_columns 

Note: SQL Server 2005 stores the last value of the identity property that was generated. To query the last value execute the following query.

select name,last_value 
   from sys.identity_columns

Find all database names in a SQL Server instance

SQL SERVER 2000:

select name from master..sysdatabases

SQL SERVER 2005:

select name from sys.databases

Note: Many enhancements were made to the database. Query all of the columns in sys.databases to understand the new enhancements like snapshot, etc.

Find all Procedures in a Database

SQL SERVER 2000:

select name from sysobjects where type='P'

SQL SERVER 2005:

select name from sys.procedures

Note: You can find whether the stored procedure execution is used in replication or if the stored procedure is a startup procedure. Execute the following queries:

select name from sys.procedures where is_execution_replicated=1
select name from sys.procedures where is_auto_executed=0

Find all tables in a Database

SQL SERVER 2000:

select name from sysobjects where type='U'

SQL SERVER 2005:

select name from sys.tables

Note: In SQL Server 2005, you can find whether a table is replicated. Execute the following query.

select * from sys.tables  where is_replicated =1

Find all views in a Database

SQL SERVER 2000:

select name from sysobjects where type='V'

SQL SERVER 2005:

select name from sys.views

Note: In SQL Server 2005, you can find whether a view is replicated. Execute the following query.

select * from sys.views where is_replicated =1

Find all Triggers in a Database

SQL SERVER 2000:

select name from sysobjects where type='TR'

SQL SERVER 2005:

select name from sys.triggers where parent_class=1

Note: In SQL Server 2005, the triggers can be Assembly trigger (CLR) or a SQL trigger. In addition, we can find whether the trigger is an AFTER trigger or INSTEAD of trigger. Execute the following query:

select name from sys.triggers where type='TA'
select name from sys.triggers where type='TR'
select name from sys.triggers where is_instead_of_trigger=1

Find all SQL logins in a server

SQL SERVER 2000:

select * from master..syslogins where isntgroup=0 and isntname=0

SQL SERVER 2005:

select * from sys.sql_logins

Find all dependencies of the SQL Object in a Database

SQL SERVER 2000:

select * from sysdepends

SQL SERVER 2005:

select * from sys.sql_dependencies

Find all data types in SQL server

SQL SERVER 2000:

select * from systypes

SQL SERVER 2005:

select * from sys.systypes

Find all error messages in SQL server

SQL SERVER 2000:

select * from master..sysmessages

SQL SERVER 2005:

select * from sys.messages

Find all the database files of the current database

SQL SERVER 2000:

select name,filename from sysfiles

SQL SERVER 2005:

select name, physical_name from sys.database_files

Find the type of index

SQL SERVER 2000: We have to use indid column to determine the type of index from 0,1 or 255.

SQL SERVER 2005:

select object_name(object_id),name, type_desc  from sys.indexes where type_desc ='CLUSTERED'
select object_name(object_id),name, type_desc  from sys.indexes where type_desc ='HEAP'
select object_name(object_id),name, type_desc  from sys.indexes where type_desc ='NONCLUSTERED'
select object_name(object_id),name, type_desc  from sys.indexes where type_desc ='XML'

This article was published on Wednesday 12 April, 2006.
Article Rating:
Votes: 0
Inexpensive System Tables and Catalog Views by Inexpensive Software Computers
Name:    
E-Mail:    
Website:
Rating:  
Rating Saved


Please note that your review for may take up to 24 hours to process and may not be immediately viewable.
 

Customer Information for System Tables and Catalog Views by MDofPC:

Ask your question about System Tables and Catalog Views by Inexpensive Software Computers
E-Mail:    
Enter Code
Random Products for System Tables and Catalog Views by MDofPC
Auto Repair Contract Form Download $9.99
Auto Repair Contract Form Download Auto Repair Contract Form Download
buy now | more info
Dell Dimension E310 Virus & Spyware Removal Hourly $35.00
Dell Dimension E310 Virus & Spyware Removal Hourly MDOFPC for the month of May presents to you the Dell Dimension E310 Virus & Spyware Removal Hourly
buy now | more info
Dell Inspirion M4040 Laptop Windows Vista X86 32 bit Drivers $9.99
Dell Inspirion M4040 Laptop Windows Vista X86 32 bit Drivers Dell Inspirion M4040 Laptop Windows Vista X86 32 bit Drivers
buy now | more info
KANSAS KS Employee Monthly Time Report Form Download $9.99
KANSAS KS Employee Monthly Time Report Form Download MDOFPC for the month of May presents to you the KANSAS KS Employee Monthly Time Report Form Download
buy now | more info
IBM Lenovo H200 1 Hour Remote Technical Computer Support Service $35.00
IBM Lenovo H200 1 Hour Remote Technical Computer Support Service IBM Lenovo H200 1 Hour Remote Technical Computer Support Service
buy now | more info
Dell Inspirion 11z 1121 Laptop Upgrade to 250GB Hard Drive $80.00
Dell Inspirion 11z 1121 Laptop Upgrade to 250GB Hard Drive MDOFPC for the month of May presents to you the Dell Inspirion 11z 1121 Laptop Upgrade to 250GB Hard Drive
buy now | more info
Acer Aspire 4937G Windows Vista X64 64 bit Drivers $9.99
Acer Aspire 4937G Windows Vista X64 64 bit Drivers Acer Aspire 4937G Windows Vista X64 64 bit Drivers
buy now | more info
Acer Aspire 5732ZG Add 2GB Ram Memory $60.00
Acer Aspire 5732ZG Add 2GB Ram Memory MDOFPC for the month of May presents to you the Acer Aspire 5732ZG Add 2GB Ram Memory
buy now | more info
AFFILIATE INFORMATION
Affiliate Information
Affiliate Program FAQ
Affiliate Log In
GENERAL INFORMATION
* FAQ Section
* Gift Voucher FAQ
* Shipping Overview
* Privacy Notice
* Conditions
* Contact Us
* Request for Quote
SUPPORT
* Create Support Ticket
* Support Forums
* Installation Manuals
Download Software
* Download Overview
* Download Instructions
* Free Download Tools
Inexpensive Software Computers Misc
* Custom Computer Packages
* ShopOnTheWeb Site Map
* Inexpensive Software Computers Overview Blog
* RSS feed for best sellers
* RSS feed for new products
* RSS feed for categories
* ROR feed for Products

 
System Tables and Catalog Views by MDofPC
System Tables and Catalog Views by Inexpensive Software Computers - Inexpensive Software Computers
Inexpensive Software Computers is a subsidiary of MD of PC Doctor of Computers. All rights reserved 2012
Please Contact: MDofPC@gmail.com or 412-250-7965 for sales or support
Fax: 412-568-0010