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 !




How to get the columns in tha table?


Posted Date: 04 Oct 2008    Resource Type: Code Snippets    Category: SQL

Posted By: Kavitha       Member Level: Silver
Rating:     Points: 5



The following code snippets will be used to get column name in particular table.

USE DBNAME

DECLARE @Schema varchar(60),
DECLARE @Table varchar(60),
DECLARE @columns varchar(1000)

SET @Table = 'Table_Name'
SET @Schema = 'Schema_Name'

SELECT @Columns = coalesce(@Columns + ', ', '') + column_name
FROM INFORMATION_SCHEMA.Columns
WHERE table_name = @Table
and table_Schema = @Schema
ORDER BY Ordinal_Position


SELECT @Columns



Regards,
Kavitha N




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sql server  .  Procedure  .  Column name  .  

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: To Calculate 30 Working days from the Input Date
Previous Resource: Comma Seprated Values for numbers
Return to Discussion Resource Index
Post New Resource
Category: SQL


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

audio conferencing services

Contact Us    Privacy Policy    Terms Of Use