Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to display n-1 columns from n number of columns, from a
single table in MS SQL server 2005?

Answers were Sorted based on User's Feedback



How to display n-1 columns from n number of columns, from a single table in MS SQL server 2005?..

Answer / k m rajesh

Declare @ColumnName Varchar(50)
Select @ColumnName = Name From syscolumns Where id = object_id(Table_Name) and ColID = (Select Count(name)-1 from SysColumns Where id = object_id(Table_Name))

Is This Answer Correct ?    0 Yes 0 No

How to display n-1 columns from n number of columns, from a single table in MS SQL server 2005?..

Answer / rajesh ranjan

Declare @ColumnName varchar(50)
select @ColumnName=Name from syscolumns where id=object_id
(Table_Name) and colid=1 --2 for second Column, 3 for third
exec ('select '+@ColumnName+' from Table_Name')

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More SQL Server Interview Questions

What is the use of toad or sqldbx.?

0 Answers   MCN Solutions,


Does index slows down insert statements?

0 Answers  


What are the steps you will take to improve performance of a poor performing query?

1 Answers   HCL,


what’s the difference between Covering Indexes and Clustered Indexes ? how to use clustered index small ?

0 Answers  


What Is Rdbms?

0 Answers   Accenture,


When would you use sql joins?

0 Answers  


What is a trigger in sql server?

0 Answers  


Where are sql server usernames and passwords stored in the sql server?

0 Answers  


Do comments need to go in a special place in sql server 2005?

0 Answers  


How to delete existing rows in a table?

0 Answers  


What is BCNF? How is it better than 2NF & 3NF?

0 Answers   Essar,


What is the difference between local table and global table

1 Answers   CarrizalSoft Technologies, Polaris,


Categories