C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Working with "sysobjects" system table in SQLServer


Posted Date: 15 Oct 2008    Resource Type: Articles    Category: Databases

Posted By: G Vijay Bhargav       Member Level: Bronze
Rating:     Points: 15



Hi,

This article gives an overall view of the sysobjects table – its commonly used fields – and querying the table for retrieving schema-related information.

Since SQLServer is an RDBMS, the information regarding its objects (database tales, views ..etc,) is also stored in the form of data which can be easily retrieved using a query.

SQLServer stores this object specific information in sysobjects table.

The commonly referred fields are:

  1. name
  2. id
  3. xtype
  4. uid
  5. crdate
  6. schema_ver



Lets go through each Field.

1. name :

Stores the database object name like 'tblTest','PK_EMPID' etc.,

2. id :

Stores an integer-value representing database object ID.

3. xtype :


Stores a character-code representing the Object-Type of the respective object.


The list of objects represented by xtype field are:

  1. Tables
  2. Views
  3. Triggers
  4. Rules
  5. Log
  6. Constraints
  7. Functions
  8. Stored-Procedures


The specified objects with their respective Character-Codes and descriptions are given below:

------------------------------------------------------------
Code Object-Type Description
------------------------------------------------------------
S Table System table

U Table User table

V View View

TR Trigger Trigger

L Log Log

C Constraint CHECK constraint

D Constraint Default or DEFAULT constraint

UQ Constraint UNIQUE Constraint

PK Constraint PRIMARY KEY

F Constraint FOREIGN KEY constraint

FN Function Scalar function

TF Function Table function

IF Function Inlined table-function

P Procedure Stored procedure

X Procedure Extended stored procedure

RF Procedure Replication filter stored procedure

------------------------------------------------------------





4. uid :

Stores an Integer-Value representing the database object-owner UserID (Referes [UID] from the [sysusers] system-table)

5. crdate :

Stores date and time representing the database object creation date.

6. schema_ver :

Stores an Integer-Values which keeps on incrementing by 1 when the user alters the respective object.




Responses

Author: Danasegarane.A    15 Oct 2008Member Level: Diamond   Points : 0
Nice Resource

Thanks for the Resource


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Xtype-values  .  Xtype  .  Working with sysobjects  .  Type  .  Sysobjects table SQL Server  .  Sysobjects table  .  Sysobjects system table  .  Sysobjects  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: SQL queries most asked in .NET/SQL Server job interviews
Previous Resource: Using Linq in ASP.NET
Return to Discussion Resource Index
Post New Resource
Category: Databases


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use