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 !






Retrieve information about database objects from system tables


Posted Date: 14 May 2008    Resource Type: Code Snippets    Category: SQL
Author: Shivshanker CheralMember Level: Diamond    
Rating: Points: 10



-- Selecting All tables
SELECT * FROM SYS.TABLES


-- selecting all error messages
SELECT TOP 20 * FROM MASTER.DBO.SYSMESSAGES


-- Selecting All system Data Types
SELECT * FROM SYS.TYPES

-- Selecting All Column Names
SELECT * FROM SYS.COLUMNS

-- sELECT ALL SYSTEM PERMISSIONS
SELECT * FROM SYS.SERVER_PERMISSIONS

-- Data Base Information including their .mdf file address
SELECT * FROM SYS.SYSDATABASES

-- LISTS FOR CURRENT DATABASE FILES
SELECT * FROM SYS.SYSFILES




Responses

Author: karthik    16 May 2008Member Level: Diamond   Points : 2
--- selecting 5 th highest value from the table

SELECT TOP 1 id
FROM
(SELECT TOP 5 id
FROM tableA
ORDER BY id ASC) top5
ORDER BY id DESC



Author: karthik    16 May 2008Member Level: Diamond   Points : 2
Get the count of columns in table

select count(name) from syscolumns where id=(select from sysobjects where name='tablename')


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

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: Select all Columns At Once
Previous Resource: Password Encryption and Decryption
Return to Discussion Resource Index
Post New Resource
Category: SQL


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use