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
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 |
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 |
What is the use of toad or sqldbx.?
Does index slows down insert statements?
What are the steps you will take to improve performance of a poor performing query?
what’s the difference between Covering Indexes and Clustered Indexes ? how to use clustered index small ?
What Is Rdbms?
When would you use sql joins?
What is a trigger in sql server?
Where are sql server usernames and passwords stored in the sql server?
Do comments need to go in a special place in sql server 2005?
How to delete existing rows in a table?
What is BCNF? How is it better than 2NF & 3NF?
What is the difference between local table and global table
1 Answers CarrizalSoft Technologies, Polaris,
Oracle (3253)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)