How to display n-1 columns from n number of columns, from a
single table in MS SQL server 2005?
Answer Posted / 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 View All Answers
What is transaction server consistency?
What is application role in sql server database security? : sql server security
What is nonclustered index on computed columns?
What are the types of subquery?
Explain trigger and trigger types?
What are the differences between stored procedure and the dynamic sql?
How to use "begin ... End" statement structures in ms sql server?
what is datawarehouse?
Explain what you mean by 3 tier architecture.
What is the difference between a local and a global temporary table?
Explain use of expression builder.
How many types of subqueries are there in sql server?
How to use go command in "sqlcmd"?
How to define and use table alias names in ms sql server?
What are cursors? Explain different types of cursors. What are the disadvantages of cursors? How can you avoid cursors?